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

Fix typing on blpop (etc) timeout argument #1224

Merged
merged 1 commit into from Dec 15, 2021
Merged

Fix typing on blpop (etc) timeout argument #1224

merged 1 commit into from Dec 15, 2021

Conversation

icgood
Copy link
Contributor

@icgood icgood commented Nov 30, 2021

What do these changes do?

Improves typing on blpop's timeout argument, which is a number of seconds (not milliseconds) and allows decimal precision:

The timeout argument is interpreted as a double value specifying the maximum number of seconds to block. A timeout of zero can be used to block indefinitely.

Other blocking b* methods were updated similarly. I also fixed some low-hanging mypy errors under tests/.

Are there changes in behavior for the user?

No change in behavior, only type hint changes.

Related issue number

N/A

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.

@icgood icgood marked this pull request as ready for review November 30, 2021 00:17
@codecov
Copy link

codecov bot commented Nov 30, 2021

Codecov Report

Merging #1224 (8f3890c) into master (dbdd0ad) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1224      +/-   ##
==========================================
- Coverage   90.67%   90.65%   -0.03%     
==========================================
  Files          21       21              
  Lines        6875     6879       +4     
  Branches      794      794              
==========================================
+ Hits         6234     6236       +2     
- Misses        469      470       +1     
- Partials      172      173       +1     
Flag Coverage Δ
unit 90.56% <100.00%> (-0.03%) ⬇️

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

Impacted Files Coverage Δ
aioredis/client.py 82.56% <100.00%> (+<0.01%) ⬆️
tests/conftest.py 92.41% <100.00%> (+0.16%) ⬆️
aioredis/connection.py 77.15% <0.00%> (-0.24%) ⬇️

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 dbdd0ad...8f3890c. Read the comment docs.

Copy link
Collaborator

@Andrew-Chen-Wang Andrew-Chen-Wang left a comment

Choose a reason for hiding this comment

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

Thanks! We'll want to change the name of the TimeoutSecT to something more specific to BL/BR ops because there are other arguments that also include a timeout argument.

@icgood
Copy link
Contributor Author

icgood commented Nov 30, 2021

We'll want to change the name of the TimeoutSecT to something more specific to BL/BR ops because there are other arguments that also include a timeout argument.

@Andrew-Chen-Wang Yeah, that was the reason I went with TimeoutSecT, to differentiate it from other timeout= arguments that take milliseconds. I verified that the spots I switched to TimeoutSecT were all documented as taking seconds, the same way as BLPOP. Would any of the following be preferable to you?

  • TimeoutSecondsT
  • SecondsT
  • TimeoutSecondsT + TimeoutMillisT for millisecond values (simple alias for int).

@Andrew-Chen-Wang
Copy link
Collaborator

I see. I fear that some other redis command would also have seconds for timeout arg. I was thinking in terms of blocking list like BLTimeoutT, but if the only redis commands that use secondsare the blocking list primitives, then I think the current state is fine.

Copy link
Collaborator

@Andrew-Chen-Wang Andrew-Chen-Wang left a comment

Choose a reason for hiding this comment

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

Thanks a lot!

@Andrew-Chen-Wang Andrew-Chen-Wang merged commit 5062740 into aio-libs-abandoned:master Dec 15, 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

2 participants