From 00d2066564d70a4246eb4b2b3cb4af907a40c874 Mon Sep 17 00:00:00 2001 From: Untone Date: Fri, 13 Oct 2023 03:08:59 +0300 Subject: [PATCH] race-fix4 --- resolvers/load.py | 4 ++-- services/redis.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resolvers/load.py b/resolvers/load.py index 7fb69de..834e3b1 100644 --- a/resolvers/load.py +++ b/resolvers/load.py @@ -56,11 +56,11 @@ async def load_chats(_, info, limit: int = 50, offset: int = 0): for cid in cids: # Start a pipeline - pipeline = redis.pipeline() + pipeline = await redis.pipeline() # Add the GET command to the pipeline pipeline.get(f"chats/{cid}") # Execute the pipeline - result = pipeline.execute() + result = await pipeline.execute() # Get the result of the GET command c = result[0] print(f"got chat {c}") diff --git a/services/redis.py b/services/redis.py index 1632a1c..f45659f 100644 --- a/services/redis.py +++ b/services/redis.py @@ -52,9 +52,9 @@ class RedisCache: print(f"[redis] MGET {key} {keys}") return await self._redis.mget(key, *keys) - def pipeline(self): + async def pipeline(self): print(f"[redis] pipeline") - return self._redis.pipeline() + return await self._redis.pipeline() redis = RedisCache()