Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

Synchronized reading the responses from a connection #1106

Merged
merged 3 commits into from Aug 26, 2021
Merged

Synchronized reading the responses from a connection #1106

merged 3 commits into from Aug 26, 2021

Conversation

fedej
Copy link

@fedej fedej commented Aug 12, 2021

What do these changes do?

This is to allow running concurrent coroutines over a single connection. This is not a replacement for the ConnectionPool.

It seems like sending concurrent commands creates race conditions at the time we try to read from the connection. The idea of the lock per connection would prevent multiple concurrent reads.

Are there changes in behavior for the user?

No

Related issue number

1105

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt
    • The format is <Name> <Surname>.
    • Please keep alphabetical order, the file is sorted by names.
  • Add a new news fragment into the CHANGES/ folder
    • name it <issue_id>.<type> (e.g. 588.bugfix)
    • if you don't have an issue_id change it to the pr id after creating the PR
    • ensure type is one of the following:
      • .feature: Signifying a new feature.
      • .bugfix: Signifying a bug fix.
      • .doc: Signifying a documentation improvement.
      • .removal: Signifying a deprecation or removal of public API.
      • .misc: A ticket has been closed, but it is not of interest to users.
    • Make sure to use full sentences with correct case and punctuation, for example:
      Fix issue with non-ascii contents in doctest text files.

@fedej fedej marked this pull request as ready for review August 12, 2021 19:05
@seandstewart
Copy link
Collaborator

This looks good, but just FYI we're not getting concurrency with this, as we're using a lock. The lock is forcing synchronization at the client level. Still a good thing to merge, but maybe update the change artifact to be more clear.

@codecov
Copy link

codecov bot commented Aug 12, 2021

Codecov Report

Merging #1106 (6983582) into master (04fefd8) will decrease coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1106      +/-   ##
==========================================
- Coverage   89.22%   89.18%   -0.05%     
==========================================
  Files          21       21              
  Lines        6823     6830       +7     
  Branches      653      654       +1     
==========================================
+ Hits         6088     6091       +3     
- Misses        567      569       +2     
- Partials      168      170       +2     
Flag Coverage Δ
unit 89.15% <100.00%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
aioredis/connection.py 66.09% <100.00%> (-0.17%) ⬇️
tests/test_connection.py 69.23% <100.00%> (+7.32%) ⬆️
aioredis/client.py 82.20% <0.00%> (-0.11%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 04fefd8...6983582. Read the comment docs.

@fedej fedej changed the title Allow concurrent coroutines sending commands over a single connection Synchronized reading the responses from a connection Aug 13, 2021
Copy link
Contributor

@abrookins abrookins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! 👍

@abrookins abrookins merged commit 1855756 into aio-libs-abandoned:master Aug 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants