redis-multi-exec-fix-3

This commit is contained in:
Untone 2023-10-13 11:38:13 +03:00
parent 25e05381cb
commit 9b1c0ff792

View File

@ -11,7 +11,7 @@ class RedisCache:
async def connect(self): async def connect(self):
self._redis = aredis.StrictRedis.from_url(self._uri, decode_responses=True) 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}") print(f"[redis] PING response: {response}")
async def disconnect(self): async def disconnect(self):
@ -24,8 +24,9 @@ class RedisCache:
try: try:
print("[redis] " + command + " " + " ".join(args)) print("[redis] " + command + " " + " ".join(args))
return await self._redis.execute_command(command, *args, **kwargs) return await self._redis.execute_command(command, *args, **kwargs)
except Exception: except Exception as e:
pass print(f"[redis] error: {e}")
return None
async def subscribe(self, *channels): async def subscribe(self, *channels):
if not self._redis: if not self._redis: