-
Notifications
You must be signed in to change notification settings - Fork 223
Add support for success reward and fractional token mgmt #4394
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
base: arc-token-bucket
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| --- | ||
| applies_to: | ||
| - client | ||
| authors: | ||
| - annahay | ||
| references: [] | ||
| breaking: false | ||
| new_feature: true | ||
| bug_fix: false | ||
| --- | ||
| Add support for configurable token bucket success reward and fractional token management |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -210,8 +210,11 @@ impl RetryStrategy for StandardRetryStrategy { | |
| .unwrap_or(false); | ||
| update_rate_limiter_if_exists(runtime_components, cfg, is_throttling_error); | ||
|
|
||
| // on success release any retry quota held by previous attempts | ||
| // on success release any retry quota held by previous attempts and award success tokens | ||
| if !ctx.is_failed() { | ||
| // When a request succeeds, we grant an award, if present | ||
| token_bucket.reward_success(); | ||
|
|
||
| if let NoPermitWasReleased = self.release_retry_permit() { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to worry about
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the CI testing revealed that In the case where we have a race condition that results in the number of available permits being greater than max after a |
||
| // In the event that there was no retry permit to release, we generate new | ||
| // permits from nothing. We do this to make up for permits we had to "forget". | ||
|
|
||
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 will reward every successful attempt even retries, is that what you were going for?
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.
Yes, that is the intention