Skip to content

Conversation

narukeu
Copy link

@narukeu narukeu commented Sep 28, 2025

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

  • New: addJitter.ts
  • Export added in index.ts
  • Tests: addJitter.spec.ts (range, non‑negative, deterministic RNG, zero factor, mean sanity)
  • Docs: EN / zh_hans / ko / ja reference pages

@narukeu narukeu requested a review from raon0211 as a code owner September 28, 2025 03:39
@Copilot Copilot AI review requested due to automatic review settings September 28, 2025 03:39
@narukeu narukeu requested a review from dayongkr as a code owner September 28, 2025 03:39
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

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.

1 participant