From 9b1c0ff79295c329792f4d97c020100c092cd0c8 Mon Sep 17 00:00:00 2001 From: Untone Date: Fri, 13 Oct 2023 11:38:13 +0300 Subject: [PATCH] redis-multi-exec-fix-3 --- services/redis.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/services/redis.py b/services/redis.py index 3aa5f08..d33b6d5 100644 --- a/services/redis.py +++ b/services/redis.py @@ -11,7 +11,7 @@ class RedisCache: async def connect(self): self._redis = aredis.StrictRedis.from_url(self._uri, decode_responses=True) - response = await self._redis.execute('PING') + response = await self.execute('PING') print(f"[redis] PING response: {response}") async def disconnect(self): @@ -24,8 +24,9 @@ class RedisCache: try: print("[redis] " + command + " " + " ".join(args)) return await self._redis.execute_command(command, *args, **kwargs) - except Exception: - pass + except Exception as e: + print(f"[redis] error: {e}") + return None async def subscribe(self, *channels): if not self._redis: