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

retry: Change Policy to accept &mut self #681

Merged
merged 10 commits into from
Aug 23, 2022
Prev Previous commit
Next Next commit
Rename Checking to Waiting
  • Loading branch information
LucioFranco committed Aug 22, 2022
commit e679d5dfd728768b1cbcbe0b660eeeac21f87661
14 changes: 7 additions & 7 deletions tower/src/retry/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ pin_project! {
future: F
},
// Polling the future from [`Policy::retry`]
Checking {
Waiting {
#[pin]
checking: P
waiting: P
},
// Polling [`Service::poll_ready`] after [`Checking`] was OK.
// Polling [`Service::poll_ready`] after [`Waiting`] was OK.
Retrying,
}
}
Expand Down Expand Up @@ -77,8 +77,8 @@ where
let mut result = ready!(future.poll(cx));
if let Some(req) = &mut this.request {
match this.retry.policy.retry(req, &mut result) {
Some(checking) => {
this.state.set(State::Checking { checking });
Some(waiting) => {
this.state.set(State::Waiting { waiting });
}
None => return Poll::Ready(result),
}
Expand All @@ -87,8 +87,8 @@ where
return Poll::Ready(result);
}
}
StateProj::Checking { checking } => {
ready!(checking.poll(cx));
StateProj::Waiting { waiting } => {
ready!(waiting.poll(cx));

this.state.set(State::Retrying);
}
Expand Down