-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Dev/no can read #2360
Dev/no can read #2360
Conversation
Codecov ReportBase: 78.38% // Head: 92.16% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #2360 +/- ##
===========================================
+ Coverage 78.38% 92.16% +13.77%
===========================================
Files 110 110
Lines 27976 28857 +881
===========================================
+ Hits 21929 26595 +4666
+ Misses 6047 2262 -3785
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. |
06fadbc
to
2e619b2
Compare
2e619b2
to
e449904
Compare
e449904
to
75f447e
Compare
@kristjanvalur Can you resolve the conflicts with master? |
75f447e
to
b13b92b
Compare
@kristjanvalur again... |
No problem, it is best that I resolve these myself anyway. |
Remove timeout argument, always timeout immediately.
b13b92b
to
882881f
Compare
This PR broke async
The timeout parameter should only affect the wait operation and never cause messages to be dropped. |
Thanks for pointing this out. I've created a separate issue, #2513 |
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
The
asyncio.Connection.can_read()
API is unnecessary in async-io, since polling a connection is best done with timeout.Keeping this api adds complexity in the lower layers of the asyncio.Connection since it requires reading data and then "unreading" them for subsequent
read
operations.Further, this code is almost exclusively used by assertion macros, to make sure that there is no data present on a connection pulled from a connection pool. For this use case, it is fine that the read data is discarded.
The only remaining use case was in the
PubSub
implementation, but that can be done differently.Renaming the method to
can_read_destructive()
and simplifying it, getting rid of the "keep any read data for next read" logic, paves the way for further simplifications of the asyncio connection code, and other pull requests in the same ares (getting rid of locking, buffering, simplifying timeouts, etc)The PR contains elements from Pull Requests #2356 and #2104 as necessary for it to work properly