Skip to content

Commit bc58542

Browse files
ian28223andymccurdy
authored andcommitted
Return index 4 as the command if not a list
command is always a list. If index 3 is not a list, assume Redis Enterprise and return index 4 instead
1 parent c7e26ae commit bc58542

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

redis/client.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,12 @@ def parse_slowlog_get(response, **options):
404404
'id': item[0],
405405
'start_time': int(item[1]),
406406
'duration': int(item[2]),
407-
'command': space.join(item[3])
407+
'command':
408+
# Redis Enterprise injects another entry at index [3], which has
409+
# the complexity info (i.e. the value N in case the command has
410+
# an O(N) complexity) instead of the command.
411+
space.join(item[3]) if isinstance(item[3], list) else
412+
space.join(item[4])
408413
} for item in response]
409414

410415

0 commit comments

Comments
 (0)