Skip to content

Conversation

@petyaslavova
Copy link
Collaborator

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:

  • Do tests and lints pass with this change?
  • 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)?

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

Fixes #3791

@petyaslavova petyaslavova requested a review from Copilot December 8, 2025 12:43
@petyaslavova petyaslavova changed the title PubSub client health check handling for sync client implementation Fix PubSub client health check handling for sync client implementation Dec 8, 2025
Copy link
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 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 both decode_responses=True and decode_responses=False scenarios
  • 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug in PubSub client health check handling

2 participants