Skip to content

Commit

Permalink
🐛 worker: Remove invalid usage of asyncio.wait with python 3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
phlmn committed Dec 28, 2023
1 parent 0804b17 commit a4e451a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions worker/transcribee_worker/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ async def transaction(self, message: str) -> AsyncGenerator:
await self._send_change(change)

async def _discard_messages(self):
pending = [self._stop.wait(), self.conn.recv()]
pending = [
asyncio.create_task(self._stop.wait()),
asyncio.create_task(self.conn.recv()),
]
while True:
done, pending = await asyncio.wait(
pending, return_when=asyncio.FIRST_COMPLETED
Expand All @@ -49,7 +52,7 @@ async def _discard_messages(self):
task.cancel()
return
else:
pending.add(self.conn.recv())
pending.add(asyncio.create_task(self.conn.recv()))

def stop(self):
self._stop.set()
Expand Down

0 comments on commit a4e451a

Please sign in to comment.