From e96ca0a16469fbc697ee560ca4af12511a35c1ed Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Mon, 5 Jun 2023 15:53:29 +0800 Subject: [PATCH] fix(core): Don't wake up operator futures while not ready Signed-off-by: Xuanwo --- 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 0be8fb2569ad..1998d97b3ef0 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 = 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 } }