fix: makes task status shared across multiple instances in RQ mode, resolves #378 (#415)

Signed-off-by: Pawel Rein <pawel.rein@prezi.com>
This commit is contained in:
Paweł Rein
2025-10-21 15:08:42 +02:00
committed by GitHub
parent 9672f310b1
commit 0961f2c574
3 changed files with 307 additions and 23 deletions

View File

@@ -869,7 +869,10 @@ def create_app(): # noqa: C901
assert isinstance(orchestrator.notifier, WebsocketNotifier)
await websocket.accept()
if task_id not in orchestrator.tasks:
try:
# Get task status from Redis or RQ directly instead of checking in-memory registry
task = await orchestrator.task_status(task_id=task_id)
except TaskNotFoundError:
await websocket.send_text(
WebsocketMessage(
message=MessageKind.ERROR, error="Task not found."
@@ -878,8 +881,6 @@ def create_app(): # noqa: C901
await websocket.close()
return
task = orchestrator.tasks[task_id]
# Track active WebSocket connections for this job
orchestrator.notifier.task_subscribers[task_id].add(websocket)