[Refactor] Optimize jitter calculation in ApplyJitter method for improved performance#2829
Closed
FahadAkash wants to merge 1 commit intoApp-vNext:mainfrom
Closed
[Refactor] Optimize jitter calculation in ApplyJitter method for improved performance#2829FahadAkash wants to merge 1 commit intoApp-vNext:mainfrom
FahadAkash wants to merge 1 commit intoApp-vNext:mainfrom
Conversation
Corrects the calculation of randomDelay and offset in the ApplyJitter method to ensure jitter is applied symmetrically around the original delay.
Member
|
Thanks for your PR.
|
Author
|
@martincostello Thanks for the review! To clarify:
|
Member
|
Thanks for the updates to the PR description. Please:
|
quannguyentps
approved these changes
Jan 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Improve performance of jitter calculation in RetryHelper.ApplyJitter
The issue or feature being addressed
This PR optimizes the jitter calculation in the
RetryHelper.ApplyJittermethod to improve computational efficiency while maintaining identical behavioral characteristics.Details on the feature implementation
The PR refactors the jitter calculation to reduce arithmetic operations and improve code clarity:
Current implementation:
Optimized implementation:
Benefits
[-offset/2, +offset/2]Mathematical proof of equivalence
Original:
Optimized: