diff --git a/frontend/src/queries/query.ts b/frontend/src/queries/query.ts index 10aaf96318eea..9628a177b39f0 100644 --- a/frontend/src/queries/query.ts +++ b/frontend/src/queries/query.ts @@ -158,6 +158,7 @@ async function executeQuery( onerror(err) { abortController.abort() reject(err) + throw err // make sure fetchEventSource doesn't attempt to retry }, }).catch(reject) }) diff --git a/posthog/api/query.py b/posthog/api/query.py index 8143474256e32..695fbc9456b4c 100644 --- a/posthog/api/query.py +++ b/posthog/api/query.py @@ -314,7 +314,8 @@ async def event_stream(): status = await sync_to_async(manager.get_clickhouse_progresses)() if isinstance(status, BaseModel): - yield f"data: {status.model_dump_json(by_alias=True)}\n\n".encode() + status_update = {"complete": False, **status.model_dump(by_alias=True)} + yield f"data: {json.dumps(status_update)}\n\n".encode() last_update_time = current_time # Just ignore errors when getting progress, shouldn't impact users except Exception as e: