Skip to content

Commit

Permalink
fix: wrap redis.parse_response to remove key prefixes
Browse files Browse the repository at this point in the history
Co-authored-by: Matus Valo <[email protected]>
  • Loading branch information
pomegranited and matusvalo authored Aug 23, 2021
1 parent d95ce1d commit 537534a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions kombu/transport/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,18 @@ def _prefix_args(self, args):

return [command, *args]

def parse_response(self, connection, command_name, **options):
"""Parses a response from the Redis server.
Method wraps ``redis.parse_response()`` to remove prefixes of keys
returned by redis command.
"""
ret = super().parse_response(connection, command_name, **options)
if command_name == 'BRPOP' and ret:
key, value = ret
key = key[len(self.global_keyprefix):]
return key, value
return ret
def execute_command(self, *args, **kwargs):
return super().execute_command(*self._prefix_args(args), **kwargs)

Expand Down

0 comments on commit 537534a

Please sign in to comment.