Skip to content

Commit 1766bdc

Browse files
C1-BA-B1-F3Sisyphus
authored andcommitted
Fix sync zero blocking timeout: convert 0 to None for indefinite blocking
The sync parse_response was passing blocking_timeout=0 directly to read_response(), causing a zero-second socket read that raises TimeoutError immediately. The async clients already convert 0 to None for indefinite blocking; this applies the same fix to the sync path.
1 parent a88e6fe commit 1766bdc

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

redis/client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,11 @@ def parse_response(self, connection, command_name, **options):
860860
# This ensures the socket timeout is long enough to wait for the
861861
# blocking command's timeout
862862
blocking_timeout = options.pop("_blocking_timeout", SENTINEL)
863+
# When the Redis server is told to block indefinitely (timeout=0),
864+
# the client must also wait indefinitely rather than issuing a
865+
# zero-second socket read.
866+
if blocking_timeout == 0:
867+
blocking_timeout = None
863868
try:
864869
if NEVER_DECODE in options:
865870
response = connection.read_response(disable_decoding=True)

0 commit comments

Comments
 (0)