Merged
Conversation
…try-After support - Wraps a delegate HttpClient and retries 429 responses up to maxRetries times - Honours Retry-After header (integer seconds) when present - Falls back to exponential backoff with ±20% jitter - Both send() and sendAsync() implement retry logic - isRetriable() is protected for subclass extensibility
- Add retryEnabled, maxRetries, initialRetryDelayMs, maxRetryDelayMs fields to Builder - installRetryingClient() replaces both auth.httpClient and auth.apiClient.builder - Auth refresh/re-login calls (AuthManager.httpClient) now benefit from retry - ThingsboardApi HTTP calls get a RetryingHttpClient via the replaced ApiClient builder - Make AuthManager.httpClient non-final and package-private to allow replacement - Update class Javadoc with retry examples and new Builder methods
… common sources to CE - 5 unit tests covering: no-retry on 200, retry then success, retry exhaustion, Retry-After header respect, and isRetriable correctness - Copy updated RetryingHttpClient and ThingsboardClient from common/ into ce/ (mirrors what generate-client.sh does; common/ is the source of truth)
- Fix long overflow in exponential backoff by clamping shift to 30 - Rename retryEnabled -> retryOnRateLimit for clarity - Replace anonymous HttpClient.Builder hack with RetryableApiClient subclass that overrides getHttpClient(), eliminating 60 lines - Restore AuthManager.httpClient to private final - Unify Builder.build() into a single linear flow
Member
Author
ViacheslavKlimov
left a comment
There was a problem hiding this comment.
Review summary
Reviewed 10 changed files in Retries on rate limits. Clean implementation of RetryingHttpClient with exponential backoff, jitter, and Retry-After support, nicely wired in via RetryableApiClient. Found 0 high-confidence issues and 3 low-confidence observations commented inline.
This review was auto-generated by Claude. Findings may contain errors — please verify before applying changes.
- Close response body before retrying to avoid leaking connections - Clamp jittered delay to maxDelayMs so it remains a hard ceiling - Add comment explaining push-promise sendAsync skips retry - Move RetryingHttpClientTest from ce/ to common/ where the source lives
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.
No description provided.