Skip to content

Commit 820e0b7

Browse files
Fix aioredis version crash (#661)
Co-authored-by: Uma Annamalai <[email protected]>
1 parent c96ffc5 commit 820e0b7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

newrelic/hooks/datastore_aioredis.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
import aioredis
2828

2929
try:
30-
AIOREDIS_VERSION = tuple(int(x) for x in getattr(aioredis, "__version__").split("."))
30+
AIOREDIS_VERSION = lambda: tuple(int(x) for x in getattr(aioredis, "__version__").split("."))
3131
except Exception:
32-
AIOREDIS_VERSION = (0, 0, 0)
32+
AIOREDIS_VERSION = lambda: (0, 0, 0)
3333

3434

3535
def _conn_attrs_to_dict(connection):
@@ -68,7 +68,7 @@ def _nr_wrapper_AioRedis_method_(wrapped, instance, args, kwargs):
6868
# Check for transaction and return early if found.
6969
# Method will return synchronously without executing,
7070
# it will be added to the command stack and run later.
71-
if AIOREDIS_VERSION < (2,):
71+
if AIOREDIS_VERSION() < (2,):
7272
# AioRedis v1 uses a RedisBuffer instead of a real connection for queueing up pipeline commands
7373
from aioredis.commands.transaction import _RedisBuffer
7474
if isinstance(instance._pool_or_conn, _RedisBuffer):

0 commit comments

Comments
 (0)