Skip to content

Add configurable maxBackoffMs for rate limit retries#103

Draft
jeffreyparker wants to merge 2 commits intomasterfrom
feature/configurable-max-backoff
Draft

Add configurable maxBackoffMs for rate limit retries#103
jeffreyparker wants to merge 2 commits intomasterfrom
feature/configurable-max-backoff

Conversation

@jeffreyparker
Copy link

Summary

  • Adds a useMaxBackoffMs() method to the ClientBuilder so callers can configure the maximum backoff threshold for 429 (rate limit) retry logic.
  • Setting maxBackoffMs to 0 disables retries entirely.
  • Default behavior (32000ms max backoff) is preserved.

Test plan

  • Unit test: testMaxBackoffZeroDisablesRetry — verifies that setting maxBackoff to 0 returns the 429 immediately with no retries.
  • Unit test: testMaxBackoffCustomLimit — verifies that a custom limit (4000ms) caps retries correctly.
  • Existing retry tests continue to pass with default behavior.

Allow callers to configure the maximum backoff threshold for 429 retry
logic via a new useMaxBackoffMs() builder method. Setting maxBackoffMs
to 0 disables retries entirely. The default (32000ms) preserves existing
behavior.
- Reject negative values in both useMaxBackoffMs() builder method and
  setMaxBackoffMs() setter with IllegalArgumentException
- Clarify Javadoc that maxBackoffMs is the base backoff threshold before
  jitter (actual sleep includes up to 1000ms random jitter)
- Add test for negative value rejection
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