Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions internal/dashboard/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,20 +193,21 @@ func (h *Handler) handleSSE(w http.ResponseWriter, r *http.Request) {
return true
}

initial := h.store.GetAll()
if !writeEvent("snapshot", initial) {
return
}

// When the store is notifying (the default via Wrap), new entries are
// pushed as they arrive; the ticker degrades to a heartbeat and a
// safety-net resync.
// safety-net resync. Subscribe before taking the snapshot so an Add in
// between is never silently missed — it just triggers one no-op flush.
var notify <-chan struct{}
if ns, ok := h.store.(*store.NotifyingStore); ok {
ch, cancel := ns.Subscribe()
defer cancel()
notify = ch
}

initial := h.store.GetAll()
if !writeEvent("snapshot", initial) {
return
}
tick := 15 * time.Second
if notify == nil {
tick = 2 * time.Second
Expand Down
Loading