race-fix
This commit is contained in:
parent
3b5836a4f2
commit
b0de5e5596
|
@ -55,7 +55,14 @@ async def load_chats(_, info, limit: int = 50, offset: int = 0):
|
||||||
cids.append(r["chat"]["id"])
|
cids.append(r["chat"]["id"])
|
||||||
|
|
||||||
for cid in cids:
|
for cid in cids:
|
||||||
c = await redis.execute("GET", f"chats/{cid}")
|
# Start a transaction
|
||||||
|
tr = redis.multi_exec()
|
||||||
|
# Add the GET command to the transaction
|
||||||
|
fut = tr.get(f"chats/{cid}")
|
||||||
|
# Execute the transaction
|
||||||
|
await tr.execute()
|
||||||
|
# Get the result of the GET command
|
||||||
|
c = await fut
|
||||||
print(f"got chat {c}")
|
print(f"got chat {c}")
|
||||||
if c:
|
if c:
|
||||||
c = json.loads(c)
|
c = json.loads(c)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user