Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Don't call wake_by_ref in OperatorFuture #4003

Merged
merged 3 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/src/raw/http_util/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
31 changes: 16 additions & 15 deletions core/src/types/operator/operator_futures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

Expand Down
Loading