web: show a running turn only after replay catches up
The room marked the SSE stream live when the response headers arrived, before it read the durable backlog. A replayed turn_start therefore showed "Rhema is working..." until its turn_end arrived at the end of the replay, even for a turn that had finished. The feed now closes its replay with a live-only ready frame, and the client marks the stream live on that frame. A backlog over the 2000-row cap sends lag instead, so a skipped turn_end cannot leave the room running either.
This commit is contained in:
1 parent
a40a7a6b36
commit
62fa380ec0
3 files changed
+28
-2
No files matched your search
@@ -379,6 +379,11 @@ function processChunk(chunk: string) {
|
||||
handleLag()
|
||||
return
|
||||
}
|
||||
if (envelope.kind === 'ready') {
|
||||
retryIndex = 0
|
||||
streamState.value = 'live'
|
||||
return
|
||||
}
|
||||
handleEnvelope(envelope)
|
||||
scheduleStick()
|
||||
} catch {
|
||||
@@ -412,8 +417,6 @@ async function connectEvents() {
|
||||
}
|
||||
throw new Error('The live feed is unavailable.')
|
||||
}
|
||||
streamState.value = 'live'
|
||||
retryIndex = 0
|
||||
const reader = response.body.getReader()
|
||||
const decoder = new TextDecoder()
|
||||
let buffer = ''
|
||||
|
||||
Reference in new issue
Block a user