Conversation
The simple usage demo left the pool open, so redis 5.0–5.2 raised RuntimeError after the event loop shut down. Fixes python-arq#480
|
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #533 +/- ##
==========================================
- Coverage 96.27% 95.85% -0.43%
==========================================
Files 11 11
Lines 1074 1085 +11
Branches 209 144 -65
==========================================
+ Hits 1034 1040 +6
- Misses 19 24 +5
Partials 21 21 see 1 file with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Simple Usage example creates a Redis pool and returns. On redis 5.0 through 5.2,
AbstractConnection.__del__then calls_writer.close()afterasyncio.runhas closed the loop. The process printsRuntimeError: Event loop is closedand exits non-zero.await redis.close()in afinallyblock disconnects those writers first.close()is the methodWorkeralready uses, and it exists acrossredis>=4.2,<6. On redis 5 it forwards toaclose().aclose()itself arrived in redis 5.0.1, so the examples stay runnable on redis 4.x.The other documentation examples that call
create_poolfromasyncio.runclose the pool the same way.Fixes #480
Test plan
docs/examples/main_demo.py,slow_job.py, andretry.pyfinish with noEvent loop is closed.pytest tests/test_pool_shutdown.py(uses the existing testcontainers Redis fixture)