This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git
The following commit(s) were added to refs/heads/main by this push:
new fe21ea7f5 fix(core): Don't wake up operator futures while not ready
(#2415)
fe21ea7f5 is described below
commit fe21ea7f54052b14858269a9d2f8c2b1668ca345
Author: Xuanwo <[email protected]>
AuthorDate: Mon Jun 5 16:07:38 2023 +0800
fix(core): Don't wake up operator futures while not ready (#2415)
Signed-off-by: Xuanwo <[email protected]>
---
core/src/types/operator/operator_futures.rs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/core/src/types/operator/operator_futures.rs
b/core/src/types/operator/operator_futures.rs
index 0be8fb256..1998d97b3 100644
--- a/core/src/types/operator/operator_futures.rs
+++ b/core/src/types/operator/operator_futures.rs
@@ -97,6 +97,9 @@ where
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) ->
Poll<Self::Output> {
*self = match mem::replace(self.as_mut().get_mut(),
OperatorFuture::Empty) {
OperatorFuture::Idle(inner, path, args, f) => {
+ // Wake up to make sure the future is ready after the
+ // future has been built.
+ cx.waker().wake_by_ref();
OperatorFuture::Poll(f(inner, path, args))
}
OperatorFuture::Poll(mut fut) => match fut.as_mut().poll(cx) {
@@ -107,7 +110,6 @@ where
panic!("future polled after completion");
}
};
- cx.waker().wake_by_ref();
Poll::Pending
}
}