Fixing sentinel command execution to allow returning of actual responses when meaningful - behaviour controlled by 'return_responses' argument. by mahigupta · Pull Request #3191 · redis/redis-py (original) (raw)

Conversation

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

[ Show hidden characters]({{ revealButtonHref }})

@mahigupta

Pull Request check-list

Description of change

Fixes #3139

@mahigupta

@mahigupta

@mahigupta

@mahigupta

@vladvildanov

@mahigupta

@vladvildanov

@mahigupta Looks fine 👌 Working on fixing CI, docker-compose was removed from default commands in Ubuntu 22.04 LTS runner

@mahigupta

@mahigupta

@mahigupta

vladvildanov

@petyaslavova

@petyaslavova

@petyaslavova

This change will still need a few new unit tests to be added.

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 the behavior of the sentinel command response in Redis by updating the execute_command function to correctly parse responses and returning either a boolean or the original response based on the provided options.

Reviewed Changes

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

File Description
redis/sentinel.py Updated execute_command to handle return_responses and once logic.
redis/commands/sentinel.py Modified sentinel command method calls to include new options.
redis/asyncio/sentinel.py Asynchronous execute_command updated similar to its sync counterpart.
CHANGES Documented the fix for the sentinel command response behavior.

@petyaslavova

@petyaslavova

…e type for sentinel's execute_command

@petyaslavova

@petyaslavova

@petyaslavova

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 how sentinel commands parse and return responses by introducing a return_responses flag and removing the default True return behavior. It also updates several sentinel command wrappers to leverage this new flag and expands test coverage with real-sentinel integration tests.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file

File Description
tests/test_sentinel.py Added deployed_sentinel fixture and real-sentinel integration tests
tests/test_asyncio/test_sentinel.py Mirror sync changes for asyncio tests and real-instance coverage
redis/sentinel.py Refactored execute_command to support return_responses flag
redis/asyncio/sentinel.py Refactored async execute_command similarly
redis/commands/sentinel.py Updated sentinel_* wrappers to pass once/return_responses options

Comments suppressed due to low confidence (2)

redis/commands/sentinel.py:15

        """Returns a (host, port) pair for the given ``service_name``"""

redis/commands/sentinel.py:23

def sentinel_master(self, service_name):

@petyaslavova

…uilt-in 'all' function for better performance and improved readability.

@petyaslavova

…nces is now optional. Fixed the pydocs to reflect the actual method behavior.

vladvildanov

@petyaslavova petyaslavova changed the titleFixing sentinel command response Fixing sentinel command execution to allow returning of actual responses when meaningful - behaviour controlled by 'return_responses' argument.

Jun 5, 2025

ManelCoutinhoSensei pushed a commit to ManelCoutinhoSensei/redis-py that referenced this pull request

Jun 30, 2025

…ses when meaningful - behaviour controlled by 'return_responses' argument. (redis#3191)


Co-authored-by: petyaslavova petya.slavova@redis.com

ManelCoutinhoSensei pushed a commit to ManelCoutinhoSensei/redis-py that referenced this pull request

Jul 1, 2025

…ses when meaningful - behaviour controlled by 'return_responses' argument. (redis#3191)


Co-authored-by: petyaslavova petya.slavova@redis.com

petyaslavova added a commit that referenced this pull request

Jul 25, 2025

@mahigupta @petyaslavova

…ses when meaningful - behaviour controlled by 'return_responses' argument. (#3191)


Co-authored-by: petyaslavova petya.slavova@redis.com

Labels