diff options
author | dvora-h <67596500+dvora-h@users.noreply.github.com> | 2023-05-08 13:09:28 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-08 13:09:28 +0300 |
commit | 093232d8b4cecaac5d8b15c908bd0f8f73927238 (patch) | |
tree | 66d1d5be5b54fac9521c303de7a9b938bd809a86 | |
parent | 9370711ba3ad341193089f04fdf325fd37956edf (diff) | |
download | redis-py-093232d8b4cecaac5d8b15c908bd0f8f73927238.tar.gz |
fix parse_slowlog_get (#2732)
-rwxr-xr-x | redis/client.py | 4 | ||||
-rw-r--r-- | tests/test_commands.py | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/redis/client.py b/redis/client.py index 79a7bff..c43a388 100755 --- a/redis/client.py +++ b/redis/client.py @@ -420,9 +420,13 @@ def parse_slowlog_get(response, **options): # an O(N) complexity) instead of the command. if isinstance(item[3], list): result["command"] = space.join(item[3]) + result["client_address"] = item[4] + result["client_name"] = item[5] else: result["complexity"] = item[3] result["command"] = space.join(item[4]) + result["client_address"] = item[5] + result["client_name"] = item[6] return result return [parse_item(item) for item in response] diff --git a/tests/test_commands.py b/tests/test_commands.py index 2b769be..4020f5e 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -861,6 +861,8 @@ class TestRedisCommands: # make sure other attributes are typed correctly assert isinstance(slowlog[0]["start_time"], int) assert isinstance(slowlog[0]["duration"], int) + assert isinstance(slowlog[0]["client_address"], bytes) + assert isinstance(slowlog[0]["client_name"], bytes) # Mock result if we didn't get slowlog complexity info. if "complexity" not in slowlog[0]: |