Repository navigation
fix: return each async request its own response instead of the shared attribute - #975
Open
andret13pinto wants to merge 1 commit into
Open
andret13pinto wants to merge 1 commit into
andret13pinto wants to merge 1 commit into
Conversation
… attribute AsyncTwilioHttpClient.request stored the response on the instance and returned that attribute. With pool_connections=False it awaits session.close() after the store, so a request that starts during that await resets the attribute and the first request returns None or the other request's response. The response now lives in a local variable; the test-only attribute is still set for the tests that read it.
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 #974
AsyncTwilioHttpClient.requeststored the response inself._test_only_last_responseand returned that attribute. Withpool_connections=Falsethe method awaitssession.close()after the store. A request that starts during that await resets the attribute. The first request then returnsNoneor the other request's response.The method now keeps the response in a local variable and returns it. It still sets the test-only attribute, so the tests that read it keep working.
The new test runs two requests concurrently on one client with a session that yields on close, and checks that each gets its own response. It fails on
mainand passes with the fix.