Skip to content

fix: honor explicit zero retry wait and max wait times#1162

Open
leno23 wants to merge 1 commit into
go-resty:v3from
leno23:fix/zero-retry-wait-time-992
Open

fix: honor explicit zero retry wait and max wait times#1162
leno23 wants to merge 1 commit into
go-resty:v3from
leno23:fix/zero-retry-wait-time-992

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 17, 2026

Summary

Fixes #992

When both SetRetryWaitTime(0) and SetRetryMaxWaitTime(0) are set, jitter backoff now uses a constant zero delay instead of replacing zeros with library defaults.

Unset minimum wait (0 with a positive max) still maps to defaultWaitTime as before.

Test plan

  • go test -run 'TestRetryCoverage|TestClientRetry'
  • Added explicit zero min and max yields zero delay subtest

Made with Cursor

Fixes go-resty#992 by treating min=max=0 as constant zero backoff instead of
falling back to library defaults. Unset min still uses defaultWaitTime when
max is non-zero.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link
Copy Markdown
Member

@jeevatkm jeevatkm left a comment

Choose a reason for hiding this comment

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

@leno23 Thanks for the PR. Please fix the failing test case and have 100% patch coverage.

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.

Unintuitive handling of 0 min and max for jitter backoff

2 participants