@@ -400,17 +400,22 @@ def parse_zscan(response, **options):
400
400
401
401
def parse_slowlog_get (response , ** options ):
402
402
space = ' ' if options .get ('decode_responses' , False ) else b' '
403
- return [{
404
- 'id' : item [0 ],
405
- 'start_time' : int (item [1 ]),
406
- 'duration' : int (item [2 ]),
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 ])
413
- } for item in response ]
403
+ def parse_item (item ):
404
+ result = {
405
+ 'id' : item [0 ],
406
+ 'start_time' : int (item [1 ]),
407
+ 'duration' : int (item [2 ]),
408
+ }
409
+ # Redis Enterprise injects another entry at index [3], which has
410
+ # the complexity info (i.e. the value N in case the command has
411
+ # an O(N) complexity) instead of the command.
412
+ if isinstance (item [3 ], list ):
413
+ result ['command' ] = space .join (item [3 ])
414
+ else :
415
+ result ['complexity' ] = item [3 ]
416
+ result ['command' ] = space .join (item [4 ])
417
+ return result
418
+ return [parse_item (item ) for item in response ]
414
419
415
420
416
421
def parse_cluster_info (response , ** options ):
0 commit comments