Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix: automatically close connection pool for async Sentinel #2900

Merged

Conversation

kristjanvalur
Copy link
Contributor

@kristjanvalur kristjanvalur commented Aug 20, 2023

Pull Request check-list

Please make sure to review and check all of these items:

  • 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?

NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.

Description of change

A Redis object returned by redis.asyncio.sentinel.Sentinel() has its own ConnectionPool, but this is not closed automatically when the Redis object goes out of scope.

By setting the auto_close_connection_pool Redis attribute, it is ensured that connections are closed properly.

This fixes another issue raised in #2831

Please provide a description of the change here.

@kristjanvalur kristjanvalur changed the title automatically close connection pool for async Sentinel Fix: automatically close connection pool for async Sentinel Aug 20, 2023
@kristjanvalur kristjanvalur marked this pull request as ready for review August 20, 2023 11:41
@kristjanvalur kristjanvalur force-pushed the kristjan/close_sentinel_pool branch from d6aa6e6 to 8de625e Compare August 22, 2023 16:07
@codecov-commenter
Copy link

Codecov Report

Patch coverage: 16.00% and project coverage change: -24.85% ⚠️

Comparison is base (6968431) 91.27% compared to head (0d17f06) 66.43%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #2900       +/-   ##
===========================================
- Coverage   91.27%   66.43%   -24.85%     
===========================================
  Files         126      126               
  Lines       32368    32391       +23     
===========================================
- Hits        29545    21518     -8027     
- Misses       2823    10873     +8050     
Files Changed Coverage Δ
redis/asyncio/sentinel.py 29.88% <0.00%> (-56.87%) ⬇️
tests/test_asyncio/test_sentinel.py 35.22% <26.66%> (-64.09%) ⬇️

... and 80 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dvora-h dvora-h merged commit 19b55c6 into redis:master Aug 24, 2023
@kristjanvalur kristjanvalur deleted the kristjan/close_sentinel_pool branch August 24, 2023 09:50
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants