Skip to content

feat(retry): add JitterFactor to RetryPolicy with unit tests#69

Draft
javier-aliaga wants to merge 1 commit intodapr:mainfrom
javier-aliaga:add-jitter-option
Draft

feat(retry): add JitterFactor to RetryPolicy with unit tests#69
javier-aliaga wants to merge 1 commit intodapr:mainfrom
javier-aliaga:add-jitter-option

Conversation

@javier-aliaga
Copy link

@javier-aliaga javier-aliaga commented Mar 5, 2026

Introduce JitterFactor field to desynchronize concurrent retries using deterministic randomness (seeded by firstAttempt + attempt) for replay safety.

Clamp value to [0.0, 1.0] in Validate(). Fix MaxRetryInterval comparison (was <, now >) so delay is properly capped before jitter is applied.

Tests cover deterministic replay safety, delay reduction, zero-jitter passthrough, per-attempt variation, MaxRetryInterval capping, and validation clamping.

  Introduce JitterFactor field to desynchronize concurrent retries using
  deterministic randomness (seeded by firstAttempt + attempt) for replay safety.
  Clamp value to [0.0, 1.0] in Validate(). Fix MaxRetryInterval comparison
  (was <, now >) so delay is properly capped before jitter is applied.

  Tests cover deterministic replay safety, delay reduction, zero-jitter
  passthrough, per-attempt variation, MaxRetryInterval capping, and
  validation clamping.

Signed-off-by: Javier Aliaga <javier@diagrid.io>
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