Reduce idle screenshot churn with change-driven SSE

Emit dashboard activity updates only when terminal screen content actually changes, and tighten screenshot 304 fast-path behavior to avoid stale not-modified responses after newer activity.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
GitHub Copilot
2026-02-14 19:52:41 +00:00
parent d4be34dbc9
commit 8762e2cc7d
3 changed files with 76 additions and 12 deletions
+11
View File
@@ -50,6 +50,7 @@ type Tracker struct {
screen *te.DiffScreen
stream *te.ByteStream
changeCounter uint64
lastActivityCounter uint64
lastSnapshotCounter uint64
}
@@ -125,6 +126,16 @@ func (t *Tracker) Snapshot() Snapshot {
return snapshot
}
func (t *Tracker) ConsumeActivityChanged() bool {
t.mu.Lock()
defer t.mu.Unlock()
if t.changeCounter > t.lastActivityCounter {
t.lastActivityCounter = t.changeCounter
return true
}
return false
}
func colorToString(color te.Color) string {
if color.Name != "" {
name := strings.ToLower(strings.TrimPrefix(color.Name, "#"))