redis-py
redis-py copied to clipboard
Dev/no lock
Pull Request check-list
Please make sure to review and check all of these items:
- [x] Does
$ toxpass with this change (including linting)? - [x] Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
- [x] Is the new or changed code fully tested?
- [ ] Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
- [ ] Is there an example added to the examples folder (if applicable)?
- [ ] Was the change added to CHANGES file?
NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open.
Description of change
An asyncio.Lock present around the redis.asyncio.Connection._parser.read_response() is removed. This is not required, since only a single task should be sending/receiving on a single Connection at the same time.
There is no lock around the send() code and
Without a lock around the entire execute_command() (send, and receive) there has been no guarantee that a response is returned which matches the sent command, if more than one task are sending.
A single unittest for concurrent execution was skipped to not run in single-connection mode. This unittest would have also sporadically failed before this PR if the concurrent commands were different. As it happened, all 10 were the exact same ping command and so mismatching requests/responses were never detected.
Codecov Report
Merging #2308 (b5ebada) into master (b5ebada) will not change coverage. The diff coverage is
n/a.
:exclamation: Current head b5ebada differs from pull request most recent head 8d86e87. Consider uploading reports for the commit 8d86e87 to get more accurate results
@@ Coverage Diff @@
## master #2308 +/- ##
=======================================
Coverage 92.21% 92.21%
=======================================
Files 111 111
Lines 28781 28781
=======================================
Hits 26539 26539
Misses 2242 2242
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
As usual, sporadic CI failures with docker.
This PR, if accepted, will impact #2295 and make it simpler.
🍾