-
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
Make PythonParser resumable (alternative) #2512
Make PythonParser resumable (alternative) #2512
Conversation
Codecov ReportBase: 92.23% // Head: 92.20% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #2512 +/- ##
==========================================
- Coverage 92.23% 92.20% -0.03%
==========================================
Files 113 115 +2
Lines 29388 29530 +142
==========================================
+ Hits 27106 27229 +123
- Misses 2282 2301 +19
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. |
@kristjanvalur Do you have any idea why the tests are canceling? It only happens in these 2 PR's... |
a97064e
to
562be69
Compare
No. I'll investigate. |
562be69
to
addd59c
Compare
Turned out it was the complementary enhancement to the syncronous PythonParser causing issues. Fixed now. Both sync and async PythonParser are now restartable in case of error, same as the HiredisParser. |
current failure is with sync hiredis parser in 3.11 cluster mode, code which is not changed by this. |
Closed, since #2510 was merged (an alternative implementation) |
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
See issue #2513
Recent changes in redis.asyncio changed the way timeouts are handled, by catching timeouts on a higher level and not leave a
Connection
object in a failed state. Timeouts are now received directly when doing IO, instead of running a preliminarycan_read()
test with timeout. This resulted in significant simplification of the logic and consolidated different timeout handling.Unfortunately, the
PythonParser
, unlike theHiredisParser
was not able to deal with IO being interrupted as it didn't maintain internal state. A TimeoutException caught while parsing a response would cause data to be lost. TheHiredisParser
, however, cleanly separates parsing and IO, and maintains its own internal parse buffer which is fed by IO separately.This PR fixes
PythonParser
to keep a buffer of incomplete responses, so that if IO is interrupted, the parser'sread_response()
method can be called again, if it is interrupted during IO.Note: This is an alternative change to pr #2510
See issue #2499 where this problem was pointed out.