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