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 647eb9bb02 fix: Don't call wake_by_ref in OperatorFuture (#4003)
647eb9bb02 is described below

commit 647eb9bb0272a2c06bba2ae8aee710b3f46cdcce
Author: Xuanwo <[email protected]>
AuthorDate: Thu Jan 18 10:54:35 2024 +0800

    fix: Don't call wake_by_ref in OperatorFuture (#4003)
    
    * fix: Don't call wake_by_ref in OperatorFuture
    
    Signed-off-by: Xuanwo <[email protected]>
    
    * Fix dead loop
    
    Signed-off-by: Xuanwo <[email protected]>
    
    * Polish error message
    
    Signed-off-by: Xuanwo <[email protected]>
    
    ---------
    
    Signed-off-by: Xuanwo <[email protected]>
---
 core/src/raw/http_util/client.rs            |  4 ++--
 core/src/types/operator/operator_futures.rs | 31 +++++++++++++++--------------
 2 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/core/src/raw/http_util/client.rs b/core/src/raw/http_util/client.rs
index f83c188409..2c5e4bc5c7 100644
--- a/core/src/raw/http_util/client.rs
+++ b/core/src/raw/http_util/client.rs
@@ -156,8 +156,8 @@ impl HttpClient {
                 err.is_status()
             );
 
-            let mut oerr = Error::new(ErrorKind::Unexpected, "send async 
request")
-                .with_operation("http_util::Client::send_async")
+            let mut oerr = Error::new(ErrorKind::Unexpected, "send http 
request")
+                .with_operation("http_util::Client::send")
                 .with_context("url", uri.to_string())
                 .set_source(err);
             if is_temporary {
diff --git a/core/src/types/operator/operator_futures.rs 
b/core/src/types/operator/operator_futures.rs
index 4faf5ea523..fda23d1dff 100644
--- a/core/src/types/operator/operator_futures.rs
+++ b/core/src/types/operator/operator_futures.rs
@@ -95,22 +95,23 @@ where
     ///
     /// In general, `Empty` state should not be polled.
     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))
+        loop {
+            match mem::replace(self.as_mut().get_mut(), OperatorFuture::Empty) 
{
+                OperatorFuture::Idle(inner, path, args, f) => {
+                    *self = OperatorFuture::Poll(f(inner, path, args))
+                }
+                OperatorFuture::Poll(mut fut) => match fut.as_mut().poll(cx) {
+                    Poll::Ready(v) => return Poll::Ready(v),
+                    Poll::Pending => {
+                        *self = OperatorFuture::Poll(fut);
+                        return Poll::Pending;
+                    }
+                },
+                OperatorFuture::Empty => {
+                    panic!("future polled after completion");
+                }
             }
-            OperatorFuture::Poll(mut fut) => match fut.as_mut().poll(cx) {
-                Poll::Pending => OperatorFuture::Poll(fut),
-                Poll::Ready(v) => return Poll::Ready(v),
-            },
-            OperatorFuture::Empty => {
-                panic!("future polled after completion");
-            }
-        };
-        Poll::Pending
+        }
     }
 }
 

Reply via email to