Skip to content

Commit 1a614a6

Browse files
Handle new XAUTOCLAIM response introduced in redis>=4.3.4
[A breaking change](redis/redis-py#2252) in `redis==4.3.4` breaks Cog. This PR handles the new XAUTOCLAIM response format in a backwards-compatible way. Closes replicate#671
1 parent 91a2745 commit 1a614a6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

python/cog/server/redis_queue.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ def receive_message(self) -> Tuple[Optional[str], Optional[str]]:
124124
1,
125125
)
126126
# format: [[b'1619393873567-0', [b'mykey', b'myval']]]
127-
if raw_messages and raw_messages[0] is not None:
127+
# since redis==4.3.4 an empty response from xautoclaim is indicated by [[b'0-0', []]]
128+
if raw_messages and raw_messages[0] is not None and len(raw_messages[0]) == 2:
128129
key, raw_message = raw_messages[0]
129130
assert raw_message[0] == b"value"
130131
return key.decode(), raw_message[1].decode()

0 commit comments

Comments
 (0)