Skip to content

Conversation

kristjanvalur
Copy link
Contributor

Pull Request check-list

  • Does $ tox pass with this change (including linting)?
  • Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
  • 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?

Description of change

This change adds a "connect()" method to the PubSub class and employs that in the run method.
This makes it possible to start a run() task without knowing beforehand which subscriptions are required,
for example, when running a server that dynamically listens to various channels.

PR is provided as a suggested feature, and so there is no documentation or non-async implementation yet.

@codecov-commenter
Copy link

codecov-commenter commented Apr 27, 2022

Codecov Report

Merging #2148 (9543a59) into master (6ba4641) will decrease coverage by 0.07%.
The diff coverage is 92.85%.

@@            Coverage Diff             @@
##           master    #2148      +/-   ##
==========================================
- Coverage   92.44%   92.37%   -0.08%     
==========================================
  Files         104      104              
  Lines       24385    24458      +73     
==========================================
+ Hits        22542    22592      +50     
- Misses       1843     1866      +23     
Impacted Files Coverage Δ
tests/test_asyncio/test_pubsub.py 99.34% <90.47%> (-0.43%) ⬇️
redis/asyncio/client.py 91.98% <100.00%> (+0.05%) ⬆️
tests/test_commands.py 93.71% <0.00%> (-0.61%) ⬇️
redis/commands/core.py 83.78% <0.00%> (-0.23%) ⬇️
redis/client.py 89.46% <0.00%> (ø)
redis/asyncio/connection.py 84.72% <0.00%> (ø)
tests/test_cluster.py 97.60% <0.00%> (+0.23%) ⬆️
tests/conftest.py 87.25% <0.00%> (+0.79%) ⬆️
tests/test_function.py 27.58% <0.00%> (+2.28%) ⬆️

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 6ba4641...9543a59. Read the comment docs.

@chayim chayim added the feature New feature label May 2, 2022
@chayim
Copy link
Contributor

chayim commented May 2, 2022

Thanks @kristjanvalur! This really helps bring more parity to the async connection!

@chayim chayim changed the title Feature request: Allow PubSub.run() without previous subscribe() Async Connection: Allow PubSub.run() without previous subscribe() May 2, 2022
@chayim chayim merged commit fdb9075 into redis:master May 2, 2022
@kristjanvalur
Copy link
Contributor Author

Well, that was fast :)
If accepted, I was planning to add some docs, and provide a "sync" implementation too. Should I do that in a separate PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants