fix issues TUI display reliability
Build and Publish / Metadata (push) Successful in 10s
Build and Publish / BuildAndDeployAmd64 (push) Successful in 2m0s

This commit is contained in:
mats committed 2026-09-24 11:11:29 +02:00
1 parent a96e95212a
commit f5015581a4
5 files changed
+84 -5

No files matched your search

+16 -3
View File
@@ -155,6 +155,10 @@ func spikeKey(s features.Spike) string {
return s.Service + "\x00" + strings.Join(sigs, "\x00")
}
func patternKey(service, signature string) string {
return service + "\x00" + signature
}
// Scan runs one evaluation, mirroring the runner's Tick: load the window
// ending lag ago plus its baseline, detect exactly what the server pages on,
// and use a cooldown suppressor to tell a fresh page from an ongoing one.
@@ -184,9 +188,11 @@ func (s *scanner) Scan(ctx context.Context, now time.Time) snapshot {
// The suppressor mutates only its own state and the copies Filter makes,
// so firing keeps every pattern for display while paged marks what would
// have been sent to Telegram / the webhook.
pagedKeys := map[string]bool{}
pagedPatterns := map[string]bool{}
for _, sp := range s.pager.Filter(firing) {
pagedKeys[spikeKey(sp)] = true
for _, p := range sp.Patterns {
pagedPatterns[patternKey(sp.Service, p.Signature)] = true
}
}
nowActive := map[string]bool{}
@@ -198,7 +204,14 @@ func (s *scanner) Scan(ctx context.Context, now time.Time) snapshot {
first = end
s.active[key] = first
}
snap.Issues = append(snap.Issues, issueView{alert: alerts.NewAlert(sp, end), key: key, paged: pagedKeys[key], firstSeen: first})
paged := false
for _, p := range sp.Patterns {
if pagedPatterns[patternKey(sp.Service, p.Signature)] {
paged = true
break
}
}
snap.Issues = append(snap.Issues, issueView{alert: alerts.NewAlert(sp, end), key: key, paged: paged, firstSeen: first})
}
for key, first := range s.active {
if !nowActive[key] {