fix(webui): start a fresh event stream at recent activity, not the whole events table
This commit is contained in:
1 file changed
+6
-1
@@ -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
|
||||
|
||||
Reference in new issue
Block a user