Skip to content

Fix #643 -- Add client_fractory to Redis check#651

Merged
codingjoe merged 9 commits intomainfrom
issues/643/redis-client
Feb 18, 2026
Merged

Fix #643 -- Add client_fractory to Redis check#651
codingjoe merged 9 commits intomainfrom
issues/643/redis-client

Conversation

@codingjoe
Copy link
Copy Markdown
Owner

Redis clients may leak connections between concurrent requests.
To prevent this we need to instanciate a client per request.

Redis clients may leak connections between concurrent requests.
To prevent this we need to instanciate a client per request.
@codingjoe codingjoe self-assigned this Feb 17, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (7d5015a) to head (383d239).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #651   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           13        13           
  Lines          722       738   +16     
=========================================
+ Hits           722       738   +16     
Flag Coverage Δ
python-3.10-django-5.2 50.94% <0.00%> (-1.13%) ⬇️
python-3.10-django-5.2-celery 55.96% <0.00%> (-1.25%) ⬇️
python-3.10-django-5.2-kafka 54.06% <0.00%> (-1.20%) ⬇️
python-3.10-django-5.2-psutil 62.87% <0.00%> (-1.40%) ⬇️
python-3.10-django-5.2-rabbitmq 53.79% <0.00%> (-1.20%) ⬇️
python-3.10-django-5.2-redis 55.82% <100.00%> (+0.97%) ⬆️
python-3.10-django-5.2-rss 70.59% <0.00%> (-1.57%) ⬇️
python-3.11-django-5.2 50.94% <0.00%> (-1.13%) ⬇️
python-3.12-django-5.2 50.94% <0.00%> (-1.13%) ⬇️
python-3.12-django-6.0 50.94% <0.00%> (-1.13%) ⬇️
python-3.13-django-5.2 50.94% <0.00%> (-1.13%) ⬇️
python-3.13-django-6.0 50.94% <0.00%> (-1.13%) ⬇️
python-3.14-django-5.2 51.22% <0.00%> (-1.15%) ⬇️
python-3.14-django-5.2-celery 56.26% <0.00%> (-1.26%) ⬇️
python-3.14-django-5.2-kafka 54.22% <0.00%> (-1.21%) ⬇️
python-3.14-django-5.2-psutil 63.21% <0.00%> (-1.41%) ⬇️
python-3.14-django-5.2-rabbitmq 53.95% <0.00%> (-1.21%) ⬇️
python-3.14-django-5.2-redis 56.13% <100.00%> (+0.97%) ⬆️
python-3.14-django-5.2-rss 71.66% <0.00%> (-1.60%) ⬇️
python-3.14-django-6.0 51.22% <0.00%> (-1.15%) ⬇️

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

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codingjoe
Copy link
Copy Markdown
Owner Author

@copilot update the test suite to match the new implementation and add deprecation and regression tests.

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 17, 2026

@codingjoe I've opened a new pull request, #652, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 5 commits February 18, 2026 11:13
Co-authored-by: codingjoe <1772890+codingjoe@users.noreply.github.com>
Co-authored-by: codingjoe <1772890+codingjoe@users.noreply.github.com>
Co-authored-by: codingjoe <1772890+codingjoe@users.noreply.github.com>
@codingjoe codingjoe marked this pull request as ready for review February 18, 2026 10:19
Copilot AI review requested due to automatic review settings February 18, 2026 10:20
@codingjoe codingjoe linked an issue Feb 18, 2026 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to prevent Redis client/connection leakage across concurrent requests by introducing a client_factory pattern for the Redis health check, updating tests and installation docs accordingly.

Changes:

  • Add client_factory to the Redis health check and deprecate the client parameter.
  • Update Redis contrib tests to use client_factory and assert client closing behavior.
  • Update installation documentation to configure Redis checks using client_factory.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.

File Description
health_check/contrib/redis.py Adds client_factory, deprecates client, and adjusts initialization/closing behavior.
tests/contrib/test_redis.py Migrates tests to client_factory, adds deprecation coverage, and new lifecycle assertions.
docs/install.md Updates example configuration to pass client_factory instead of a client instance.

Comment thread health_check/contrib/redis.py Outdated
Comment thread health_check/contrib/redis.py
Comment thread tests/contrib/test_redis.py Outdated
Comment thread tests/contrib/test_redis.py Outdated
Comment thread tests/contrib/test_redis.py Outdated
Comment thread health_check/contrib/redis.py Outdated
Comment thread health_check/contrib/redis.py Outdated
@codingjoe
Copy link
Copy Markdown
Owner Author

@copilot address the review comments.

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 18, 2026

@codingjoe I've opened a new pull request, #653, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits February 18, 2026 13:31
- Create client per request in run() method, not in __post_init__
- Add validation requiring exactly one of client or client_factory
- Only close factory-created clients, not user-provided ones
- Move deprecation warning to __post_init__ for early feedback
- Update tests to verify new behavior and lifecycle management

Co-authored-by: codingjoe <1772890+codingjoe@users.noreply.github.com>
@codingjoe codingjoe merged commit f1f5120 into main Feb 18, 2026
28 checks passed
@codingjoe codingjoe deleted the issues/643/redis-client branch February 18, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Redis is bound to a different event loop

3 participants