Fix PubSub client health check handling for sync client implementation#3870
Merged
petyaslavova merged 3 commits intomasterfrom Dec 16, 2025
Merged
Fix PubSub client health check handling for sync client implementation#3870petyaslavova merged 3 commits intomasterfrom
petyaslavova merged 3 commits intomasterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in the synchronous PubSub client's health check response handling when decode_responses=True. Previously, the is_health_check_response() method would fail to recognize the string format "redis-py-health-check" that Redis returns when there are no active subscriptions. The fix adds logic to check for the appropriate response format based on the decode_responses setting.
Key changes:
- Modified
is_health_check_response()method to handle both list and string formats for bothdecode_responses=Trueanddecode_responses=Falsescenarios - Added comprehensive test coverage for sync PubSub health check response validation
- Added comprehensive test coverage for async PubSub health check response validation
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| redis/client.py | Updated is_health_check_response() method to properly handle health check responses based on decode_responses setting, adding check for string format when decode_responses=True |
| tests/test_pubsub.py | Added TestPubSubHealthCheckResponse test class with 8 test methods covering all scenarios for health check response validation in sync client |
| tests/test_asyncio/test_pubsub.py | Added TestPubSubHealthCheckResponse test class with 6 test methods covering all scenarios for health check response validation in async client |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
vladvildanov
approved these changes
Dec 16, 2025
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.
Description of change
Please provide a description of the change here.
Pull Request check-list
Please make sure to review and check all of these items:
NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.
Fixes #3791