race-fix4
This commit is contained in:
parent
7b4524232b
commit
00d2066564
|
@ -56,11 +56,11 @@ async def load_chats(_, info, limit: int = 50, offset: int = 0):
|
||||||
|
|
||||||
for cid in cids:
|
for cid in cids:
|
||||||
# Start a pipeline
|
# Start a pipeline
|
||||||
pipeline = redis.pipeline()
|
pipeline = await redis.pipeline()
|
||||||
# Add the GET command to the pipeline
|
# Add the GET command to the pipeline
|
||||||
pipeline.get(f"chats/{cid}")
|
pipeline.get(f"chats/{cid}")
|
||||||
# Execute the pipeline
|
# Execute the pipeline
|
||||||
result = pipeline.execute()
|
result = await pipeline.execute()
|
||||||
# Get the result of the GET command
|
# Get the result of the GET command
|
||||||
c = result[0]
|
c = result[0]
|
||||||
print(f"got chat {c}")
|
print(f"got chat {c}")
|
||||||
|
|
|
@ -52,9 +52,9 @@ class RedisCache:
|
||||||
print(f"[redis] MGET {key} {keys}")
|
print(f"[redis] MGET {key} {keys}")
|
||||||
return await self._redis.mget(key, *keys)
|
return await self._redis.mget(key, *keys)
|
||||||
|
|
||||||
def pipeline(self):
|
async def pipeline(self):
|
||||||
print(f"[redis] pipeline")
|
print(f"[redis] pipeline")
|
||||||
return self._redis.pipeline()
|
return await self._redis.pipeline()
|
||||||
|
|
||||||
|
|
||||||
redis = RedisCache()
|
redis = RedisCache()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user