Skip to content

Cap retry seconds after applying jitter in case jitter brought it over limit#1023

Merged
brandur merged 1 commit intomasterfrom
brandur-ceil
Aug 23, 2025
Merged

Cap retry seconds after applying jitter in case jitter brought it over limit#1023
brandur merged 1 commit intomasterfrom
brandur-ceil

Conversation

@brandur
Copy link
Copy Markdown
Contributor

@brandur brandur commented Aug 23, 2025

Response to #1022: in the default retry policy, cap retry seconds to
maxDurationSeconds after applying jitter just in case the application
of jitter brought it over limit.

This should never realistically happen due to the way exponentials work.
If attempt N would bring retry seconds over maxDurationSeconds, then
attempt N-1 will likely be nowhere near maxDurationSeconds and a 10%
jitter won't be able to bring it over, but still, capping it really
doesn't hurt, so just do it as an additional shore up.

Fixes #1022.

…r limit

Response to #1022: in the default retry policy, cap retry seconds to
`maxDurationSeconds` after applying jitter just in case the application
of jitter brought it over limit.

This should never realistically happen due to the way exponentials work.
If attempt N would bring retry seconds over `maxDurationSeconds`, then
attempt N-1 will likely be nowhere near `maxDurationSeconds` and a 10%
jitter won't be able to bring it over, but still, capping it really
doesn't hurt, so just do it as an additional shore up.

Fixes #1022.
@brandur brandur merged commit 7bb606a into master Aug 23, 2025
11 checks passed
@brandur brandur deleted the brandur-ceil branch August 23, 2025 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DefaultClientRetryPolicy potential overflow

2 participants