Open
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
Adds a new addJitter utility function to the promise module for introducing random jitter to delay values, helping prevent synchronized bursts in retry/backoff scenarios.
- Implements
addJitter(delay, factor, rng)with uniform distribution and non-negative clamping - Comprehensive test coverage including edge cases and statistical validation
- Full internationalization with documentation in English, Chinese, Korean, and Japanese
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/promise/index.ts | Exports the new addJitter function |
| src/promise/addJitter.ts | Core implementation with JSDoc documentation |
| src/promise/addJitter.spec.ts | Comprehensive test suite covering range validation, edge cases, and statistical properties |
| docs/reference/promise/addJitter.md | English documentation with examples |
| docs/zh_hans/reference/promise/addJitter.md | Chinese documentation |
| docs/ko/reference/promise/addJitter.md | Korean documentation |
| docs/ja/reference/promise/addJitter.md | Japanese documentation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Author
|
Could you please check if you have time to review this pull request? It's been a month already. |
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.
Adds
addJitter(delay, factor = 0.2, rng = Math.random)to produce a symmetric randomized delay (uniform in[delay ± delay*factor], clamped ≥ 0) for retry/backoff/polling.Changes