From 13d4a69ad23bc0dad9411758cf27c25ef03f3fdd Mon Sep 17 00:00:00 2001 From: AURUMVORXX Date: Fri, 31 Oct 2025 21:36:18 +0500 Subject: [PATCH] =?UTF-8?q?fix:=20=D0=A3=D0=BB=D1=83=D1=87=D1=88=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20awaitable=20=D0=B7=D0=B0=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D1=81=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pyg2o/server.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/pyg2o/server.py b/src/pyg2o/server.py index 4452e76..6822ef9 100644 --- a/src/pyg2o/server.py +++ b/src/pyg2o/server.py @@ -33,7 +33,7 @@ class Server: cls._register_routes(app) @classmethod - async def publish(cls, topic: str, message) -> asyncio.Future: + def publish(cls, topic: str, message) -> asyncio.Future: if topic not in cls._topics: raise KeyError('Клиентов прослушивающих этот топик не существует') @@ -43,11 +43,14 @@ class Server: # Меняем синтаксис под Squirrel data = data.replace("'", '\\"').replace('True', 'true').replace('False', 'false') + asyncio.create_task(cls._send_to_topic(topic, data)) + return request + + @classmethod + async def _send_to_topic(cls, topic, data): for connection in cls._topics[topic]: await connection.send_text(data) - return request - @classmethod async def send(cls, connection: WebSocket, message, uuid: str): data = { @@ -135,7 +138,7 @@ class Server: case {'event': event, **kwargs}: try: - cls._requests[kwargs['uuid']].set_result(kwargs) + cls._requests[kwargs['uuid']].set_result(kwargs.get('data')) except KeyError: uuid = kwargs.get('uuid') if uuid is not None: