Skip to content

Conversation

henrybarreto
Copy link
Member

This update introduces handling for the 429 HTTP status code, which indicates that the user has sent too many requests in a given amount of time. The agent will now respect the Retry-After header, allowing for more efficient request management and reducing the likelihood of overwhelming the server.

Additionally, the default retry time has been changed from 2 seconds to 5 seconds to provide a more reasonable wait time between retries, aligning with best practices for rate limiting and improving overall performance.

@henrybarreto henrybarreto requested a review from a team as a code owner August 12, 2025 19:36
@henrybarreto henrybarreto self-assigned this Aug 12, 2025
@henrybarreto henrybarreto marked this pull request as draft August 12, 2025 19:39
@henrybarreto henrybarreto force-pushed the feat/agent-too-many-requests-retry-after branch 3 times, most recently from a05751a to d0d0b8f Compare August 13, 2025 21:29
@henrybarreto henrybarreto changed the title feat(agent): deal with 429 HTTP status and Retry-After header feat(agent): deal with 429 and 503 HTTP status and Retry-After header Aug 13, 2025
@henrybarreto henrybarreto force-pushed the feat/agent-too-many-requests-retry-after branch from d0d0b8f to f602cfb Compare August 14, 2025 20:13
This update introduces handling for the 429 and 503 HTTP status code,
which indicates that the user has sent too many requests or the service
is temporary unavailable in a time. The agent will now respect the
Retry-After header, allowing for more efficient request management and
reducing the likelihood of overwhelming the server.

Additionally, the default retry time has been changed from 2 seconds to
5 seconds to provide a more reasonable wait time between retries,
aligning with best practices for rate limiting and improving overall
performance.
@henrybarreto henrybarreto force-pushed the feat/agent-too-many-requests-retry-after branch from f602cfb to 5b9bab7 Compare August 15, 2025 21:00
otavio
otavio previously approved these changes Aug 15, 2025
otavio
otavio previously approved these changes Aug 18, 2025
@henrybarreto henrybarreto marked this pull request as ready for review August 18, 2025 14:10
@henrybarreto henrybarreto requested a review from a team as a code owner August 18, 2025 14:10
This commit enhances the client’s retry logic by replacing a fixed
fallback wait time with a randomized interval whenever the server does
not supply a Retry-After header. Instead of always pausing for 5
seconds, the code now computes a random duration between 5 seconds and
65 seconds. This change helps distribute retry attempts more evenly
across clients, mitigating the risk of simultaneous reconnections (the
“thundering herd” problem) when a service becomes available again.
@henrybarreto henrybarreto force-pushed the feat/agent-too-many-requests-retry-after branch from b2eb7ed to 3e1b326 Compare August 18, 2025 14:48
@otavio otavio merged commit 4847f1a into master Aug 18, 2025
8 checks passed
@otavio otavio deleted the feat/agent-too-many-requests-retry-after branch August 18, 2025 17:18
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.

2 participants