-
Notifications
You must be signed in to change notification settings - Fork 187
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
refactor: extract retry quota into a tower service #2172
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks awesome! Excited about these changes 👍
|
||
#[test] | ||
fn retry_handler_send_sync() { | ||
fn must_be_send_sync<T: Send + Sync>() {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is cool. I know there is a crate out there called static-assertions, but what we have here will do.
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
if self.state.available() == 0 { | ||
// If no quota is available, report pending | ||
Poll::Pending |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this won't quite work—we need to schedule a wakeup when state goes back above 0. As written, if state goes to 0, that task will never get woken up
I'm going to focus on implementing the |
add: token bucket remove: token bucket from retry
0556f33
to
c6244ec
Compare
Motivation and Context
#1785
Description
This PR extracts the retry quota state from the
RetryHandler
and places it in its owntower::Layer
. This is a first step in the process to introduce adaptive retry behavior which will use its own specialized retry quota layer.Testing
Ran existing tests
Checklist
CHANGELOG.next.toml
if I made changes to the smithy-rs codegen or runtime cratesCHANGELOG.next.toml
if I made changes to the AWS SDK, generated SDK code, or SDK runtime cratesBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.