Working docker-compose.yaml added. Services start and work.

This commit is contained in:
2026-08-02 13:19:19 +05:00
parent cd3ce0337b
commit 6707a8e27e
12 changed files with 232 additions and 11 deletions
+10 -4
View File
@@ -5,7 +5,7 @@ from typing import Dict, Set
from fastapi import WebSocket
# This will be set by main.py when the app starts
# This will be set by main.py during startup
MAIN_LOOP = None
active_connections: Dict[str, Set[WebSocket]] = {}
@@ -29,13 +29,19 @@ def publish_progress(task_id: str, progress: int, message: str, status: str = "p
}
to_remove = set()
# Get the loop to use: either the stored one or try to get the current loop
loop = MAIN_LOOP
if loop is None:
try:
loop = asyncio.get_running_loop()
except RuntimeError:
# No running loop, fallback to default event loop
loop = asyncio.get_event_loop()
for websocket in active_connections.get(task_id, set()):
try:
# Use the stored main loop, or fallback to getting the current loop
loop = MAIN_LOOP or asyncio.get_running_loop()
asyncio.run_coroutine_threadsafe(websocket.send_json(data), loop)
except Exception:
# Client disconnected or other error
to_remove.add(websocket)
# Clean up disconnected clients