diff --git a/backend/internal/latest/poller.go b/backend/internal/latest/poller.go index c4c44ca..79610d2 100644 --- a/backend/internal/latest/poller.go +++ b/backend/internal/latest/poller.go @@ -686,12 +686,12 @@ func (p *Poller) checkOne(ctx context.Context, sr store.Series) (outcome readOut // stamp's value: a Series still completed keeps its original stamp, so the // age #170 prints is "since the Site first said so"; one that stopped // being completed is zeroed. - want := int64(0) + stamp := int64(0) if facts.SiteCompleted { - want = p.Now().UnixMilli() + stamp = p.Now().UnixMilli() } - if (sr.SiteCompletedAt == 0) != (want == 0) { - if err := p.Store.SetSiteCompletedAt(sr.Site, sr.SeriesID, want); err != nil { + if (sr.SiteCompletedAt == 0) != (stamp == 0) { + if err := p.Store.SetSiteCompletedAt(sr.Site, sr.SeriesID, stamp); err != nil { // Best-effort, like every poller write: never change the outcome // word the pass counts. log.Printf("latest poll %q: set site completed: %v", sr.Key(), err) diff --git a/backend/internal/store/migrations/0019_series_site_completed.sql b/backend/internal/store/migrations/0019_series_site_completed.sql index ee47164..75783cb 100644 --- a/backend/internal/store/migrations/0019_series_site_completed.sql +++ b/backend/internal/store/migrations/0019_series_site_completed.sql @@ -1,4 +1,4 @@ -- When the last successful Poll read saw the Site's own completed value -- (#168): epoch-ms, zero meaning it did not. DEFAULT 0 keeps pre-existing --- rows readable; nothing reads it yet — #170 is the surface. +-- rows readable. ALTER TABLE series ADD COLUMN site_completed_at bigint NOT NULL DEFAULT 0;