-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add nowait
flag to asyncio.Connection.disconnect()
#2356
Conversation
6ca1c3b
to
1cddc0b
Compare
Codecov ReportBase: 92.17% // Head: 92.17% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #2356 +/- ##
=======================================
Coverage 92.17% 92.17%
=======================================
Files 110 110
Lines 28924 28866 -58
=======================================
- Hits 26661 26608 -53
+ Misses 2263 2258 -5
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
This can result in other errors such as timeouts.
This can result in other errors such as timeouts.
This can result in other errors such as timeouts.
This can result in other errors such as timeouts.
8b403ef
to
987bb8e
Compare
987bb8e
to
b4fec8b
Compare
This can result in other errors such as timeouts.
This can result in other errors such as timeouts.
d681abf
to
ae80bf2
Compare
This can result in other errors such as timeouts.
@kristjanvalur Can you resolve the conflicts with master? |
This can result in other errors such as timeouts.
Co-authored-by: Aarni Koskela <[email protected]>
ae80bf2
to
6208b66
Compare
nowait
flag to asyncio.Connection.disconnect()
This can result in other errors such as timeouts.
Pull Request check-list
Please make sure to review and check all of these items:
$ tox
pass with this change (including linting)?NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.
Description of change
When the
asyncio.Connection
object encounters an exception, it often performs aself.disconnect()
. This changeadds a
nowait
flag to this method, so that in the error case,disconnect()
does not attempt to await await_closed()
on the output stream. Awaiting a buffer method at this point can cause other errors to occur.Notably an
asyncio.CancelledError
could happen, in case the entire operation is enclosed in aasync_timeout.timeout()
context manager.At any rate, if the connection is in an error state, there is no need to wait for the write buffer flush.
This PR is separate from a related pr, #2104, both about making exception handling and cancelling (via Timeout) possible.