From a4e451a2f5a22ad0f1501cab8a82a29d8f1e4fd6 Mon Sep 17 00:00:00 2001 From: Philipp Mandler Date: Thu, 28 Dec 2023 21:13:03 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20worker:=20Remove=20invalid=20usa?= =?UTF-8?q?ge=20of=20asyncio.wait=20with=20python=203.11?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/transcribee_worker/document.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/worker/transcribee_worker/document.py b/worker/transcribee_worker/document.py index 95305779..b2d15a4f 100644 --- a/worker/transcribee_worker/document.py +++ b/worker/transcribee_worker/document.py @@ -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 @@ -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()