Repository navigation
Close the response before throwing RateLimitedException - #68
Open
nachomezzadra wants to merge 1 commit into
Open
nachomezzadra wants to merge 1 commit into
nachomezzadra wants to merge 1 commit into
Conversation
A 429 threw before the response was closed, so the connection was never returned to the pool and OkHttp logged a leak warning for every rate-limited request. Fixes ipinfo#67
This branch has not been deployed
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.
Fixes #67.
On a 429,
handleRequestthrew before closing the response, so the connection leaked and OkHttp logged a "connection was leaked" warning per request. This addsresponse.close()before the throw.BaseRequestTestcovers it with a fake 429 response served by an interceptor, so it needs no token or network. It checks the body's source was closed. A second test covers the 403 path, which already closed correctly, so it doesn't regress.The existing tests that call the live API need
IPINFO_TOKEN, which fork PRs don't get, so those may show red here.mvn test -Dtest=BaseRequestTestpasses locally, and fails without the fix.