Skip to content

Commit

Permalink
Fixed bug with SLOWLOG GET response parsing from Redis Enterprise (#3441
Browse files Browse the repository at this point in the history
)
  • Loading branch information
vladvildanov authored Dec 5, 2024
1 parent c73a43d commit db8918c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions redis/_parsers/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,13 +396,20 @@ def parse_item(item):
# 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]

# These fields are optional, depends on environment.
if len(item) >= 6:
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]

# These fields are optional, depends on environment.
if len(item) >= 7:
result["client_address"] = item[5]
result["client_name"] = item[6]

return result

return [parse_item(item) for item in response]
Expand Down

0 comments on commit db8918c

Please sign in to comment.