Skip to content

Close intermediate 429 responses before retry#104

Merged
jeffreyparker merged 1 commit intomasterfrom
fix/close-429-response-before-retry
Mar 18, 2026
Merged

Close intermediate 429 responses before retry#104
jeffreyparker merged 1 commit intomasterfrom
fix/close-429-response-before-retry

Conversation

@jeffreyparker
Copy link
Contributor

Summary

  • When a request receives a 429 rate limit response and the client retries, the previous Response (and its underlying connection) was not being closed
  • This could leak connections from the OkHttp connection pool under sustained rate limiting
  • Close the response body before sleeping and retrying

Test plan

  • Existing rate limit retry unit tests pass
  • Verify no regression in retry behavior

When a request receives a 429 rate limit response and the client
retries, the previous Response (and its underlying connection) was
not being closed. This could leak connections from the OkHttp
connection pool under sustained rate limiting. Close the response
body before sleeping and retrying.
@jeffreyparker jeffreyparker marked this pull request as ready for review March 18, 2026 14:33
@jeffreyparker jeffreyparker merged commit 9633ea7 into master Mar 18, 2026
3 checks passed
@jeffreyparker jeffreyparker deleted the fix/close-429-response-before-retry branch March 18, 2026 15:04
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