Skip to content

Improve bounded jitter#25

Merged
ThomWright merged 9 commits into
mainfrom
improve-bounded-jitter
May 20, 2025
Merged

Improve bounded jitter#25
ThomWright merged 9 commits into
mainfrom
improve-bounded-jitter

Conversation

@ThomWright

@ThomWright ThomWright commented May 14, 2025

Copy link
Copy Markdown
Member

Problem

Bounded jitter would jitter between min_retry_interval and the current interval. If the first retry always uses min_retry_interval then it would never jitter the first retry.

Solution

Use 50% of min_retry_interval as the lower bound.

Example:

  • min_retry_interval = 1s
  • First retry interval will always = 1s
  • Current solution – will jitter between min interval (1s) and current interval (1s) resulting in no jitter
  • New solution – will jitter between 50% of min interval (0.5s) and current interval (1s)

@ThomWright ThomWright requested a review from a team as a code owner May 14, 2025 10:06

@tl-security-scanner tl-security-scanner Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outdated security scan result

🔍 Security scanner results

[!WARNING]
A recent change introduced MEDIUM severity issue(s) in the PR, see the inline comment(s). Please review the issue(s).

Scanning is done on each push. If an issue is fixed, its inline comment will be removed.
To handle False Positives 🚫 or leave feedback 🐞 please reach out to Security Engineering on #ask-security-scanner - Thank you!
Scan id: [e90d5c86-d49d-4062-b36b-cb29c18e6fa3]

@jdon jdon left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bounded jitter would jitter between min_retry_interval and the current interval. If the first retry always uses min_retry_interval then it would never jitter the first retry.

Why is having the jittered_wait_for being potentially 0 causing issues?

Comment thread Cargo.toml
@ThomWright

Copy link
Copy Markdown
Member Author

Bounded jitter would jitter between min_retry_interval and the current interval. If the first retry always uses min_retry_interval then it would never jitter the first retry.

Why is having the jittered_wait_for being potentially 0 causing issues?

We might be misunderstanding each other.

The problem isn't that the jittered_wait_for is potentially zero – it's that it will never be zero (or anything other than min_interval.

Also, I just noticed a bug – will fix!

@ThomWright ThomWright merged commit a2592b8 into main May 20, 2025
5 checks passed
@ThomWright ThomWright deleted the improve-bounded-jitter branch May 20, 2025 17:01
This was referenced May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants