fix: spawn → start_soon

https://anyio.readthedocs.io/en/stable/versionhistory.html v3.0.0
Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
This commit is contained in:
Raito Bezarius 2024-09-20 21:01:21 +02:00
parent eaa54db664
commit 63aa84b404

View file

@ -51,8 +51,8 @@ class Bot(IBot):
async def _run_server(self, server: Server):
try:
async with anyio.create_task_group() as tg:
await tg.spawn(server._read_lines)
await tg.spawn(server._send_lines)
tg.start_soon(server._read_lines)
tg.start_soon(server._send_lines)
except ServerDisconnectedException:
server.disconnected = True
@ -62,4 +62,4 @@ class Bot(IBot):
async with anyio.create_task_group() as tg:
while not tg.cancel_scope.cancel_called:
server = await self._server_queue.get()
await tg.spawn(self._run_server, server)
tg.start_soon(self._run_server, server)