Skip to content

Commit 093232d

Browse files
authored
fix parse_slowlog_get (#2732)
1 parent 9370711 commit 093232d

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

redis/client.py

+4
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,13 @@ def parse_item(item):
420420
# an O(N) complexity) instead of the command.
421421
if isinstance(item[3], list):
422422
result["command"] = space.join(item[3])
423+
result["client_address"] = item[4]
424+
result["client_name"] = item[5]
423425
else:
424426
result["complexity"] = item[3]
425427
result["command"] = space.join(item[4])
428+
result["client_address"] = item[5]
429+
result["client_name"] = item[6]
426430
return result
427431

428432
return [parse_item(item) for item in response]

tests/test_commands.py

+2
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,8 @@ def test_slowlog_get(self, r, slowlog):
861861
# make sure other attributes are typed correctly
862862
assert isinstance(slowlog[0]["start_time"], int)
863863
assert isinstance(slowlog[0]["duration"], int)
864+
assert isinstance(slowlog[0]["client_address"], bytes)
865+
assert isinstance(slowlog[0]["client_name"], bytes)
864866

865867
# Mock result if we didn't get slowlog complexity info.
866868
if "complexity" not in slowlog[0]:

0 commit comments

Comments
 (0)