diff --git a/internal/webui/sse.go b/internal/webui/sse.go index d08f56610..b4a27d517 100644 --- a/internal/webui/sse.go +++ b/internal/webui/sse.go @@ -16,6 +16,9 @@ import ( // sseBacklogPageSize bounds one EventsSince fetch during catch-up. const sseBacklogPageSize = 200 +// sseFreshWindow is how far back a connection without a cursor starts. +const sseFreshWindow = 5 * time.Minute + // sseNoiseKinds are event kinds not sent to the dashboard stream. var sseNoiseKinds = map[string]bool{ events.KindTurnCompleted: true, @@ -128,7 +131,9 @@ func sseCursors(r *http.Request) streamCursors { cursors.Tasks = value // legacy task cursor } if _, _, ok := storecontract.ParseEventCursor(cursors.Tasks); !ok { - cursors.Tasks = "" + // A new viewer needs recent activity, not the whole events table: + // replaying every event ever recorded froze the dashboard. + cursors.Tasks = storecontract.EventCursor(time.Now().Add(-sseFreshWindow), 0) } if cursors.Logs < 0 { cursors.Logs = 0