From 712691f3d22bc422bd305ad308eeae92cbebea09 Mon Sep 17 00:00:00 2001 From: hasslesstech Date: Fri, 27 Mar 2026 18:15:34 +0200 Subject: [PATCH] [P] Sync the async function --- MapView/datasource.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/MapView/datasource.py b/MapView/datasource.py index 5e22629..d7712a9 100644 --- a/MapView/datasource.py +++ b/MapView/datasource.py @@ -4,7 +4,6 @@ from datetime import datetime import websockets from kivy import Logger from pydantic import BaseModel, field_validator -from websockets.asyncio.connection import Connection from config import STORE_HOST, STORE_PORT @@ -65,10 +64,10 @@ class Datasource: self.connection_status = "Disconnected" Logger.debug("SERVER DISCONNECT") - async def update_db_records(self): + def update_db_records(self): if self.websocket: data = json.dumps({"id": self.user_id}) - await self.websocket.send(data, True) + asyncio.ensure_future(self.websocket.send(data)) def map_lat_lon_to_processed_agent_data(self, lat: float, lon: float) -> ProcessedAgentData | None: distances = tuple((abs(lon - marker.latitude) ** 2 + abs(lat - marker.longitude) ** 2) ** 0.5 for marker in