summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Bucad <ian.bucad@datadoghq.com>2021-04-15 15:30:29 +1000
committerAndy McCurdy <andy@andymccurdy.com>2021-05-18 10:32:36 -0700
commitbc5854217b4e94eb7a33e3da5738858a17135ca5 (patch)
tree02d87f341f477f919bf6e953a4ea918df7aedf50
parentc7e26ae6749f63b9ebf65c023f270b2ea2b9536a (diff)
downloadredis-py-bc5854217b4e94eb7a33e3da5738858a17135ca5.tar.gz
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
-rwxr-xr-xredis/client.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/redis/client.py b/redis/client.py
index 18553b9..59575cd 100755
--- a/redis/client.py
+++ b/redis/client.py
@@ -404,7 +404,12 @@ def parse_slowlog_get(response, **options):
'id': item[0],
'start_time': int(item[1]),
'duration': int(item[2]),
- 'command': space.join(item[3])
+ 'command':
+ # Redis Enterprise injects another entry at index [3], which has
+ # the complexity info (i.e. the value N in case the command has
+ # an O(N) complexity) instead of the command.
+ space.join(item[3]) if isinstance(item[3], list) else
+ space.join(item[4])
} for item in response]