From 1043982529d10020992086f3a91307d54c62e1e2 Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Mon, 2 Nov 2026 00:22:24 +1100 Subject: [PATCH] fix(daemon): stamp each run-loop cycle so the systemd watchdog keeps beating --- CHANGELOG.md | 4 ++++ internal/daemon/cycle_test.go | 16 ++++++++++++++++ internal/daemon/daemon.go | 1 + 3 files changed, 21 insertions(+) create mode 100644 internal/daemon/cycle_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 28438dfee..5663a6da4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ release's per-component sections are labelled beneath its heading. ## [Unreleased] +### archied + +- archied no longer restarts about a minute after it starts. Under systemd, the watchdog never saw a poll pass and killed it on every start since 1.56.0. + ## [1.58.0] - 2026-11-01 ### archied diff --git a/internal/daemon/cycle_test.go b/internal/daemon/cycle_test.go new file mode 100644 index 000000000..46aaad5dc --- /dev/null +++ b/internal/daemon/cycle_test.go @@ -0,0 +1,16 @@ +package daemon + +import ( + "context" + "testing" +) + +// The systemd watchdog beats only while LastPollAt is fresh, so a cycle that +// doesn't stamp it gets archied killed shortly after every start. +func TestCycleMarksPollPass(t *testing.T) { + d := &Daemon{} + d.Cycle(context.Background()) + if d.LastPollAt().IsZero() { + t.Fatal("Cycle didn't record a poll pass") + } +} diff --git a/internal/daemon/daemon.go b/internal/daemon/daemon.go index 713954f7e..15413069a 100644 --- a/internal/daemon/daemon.go +++ b/internal/daemon/daemon.go @@ -489,6 +489,7 @@ func (d *Daemon) RunOnce(ctx context.Context) { // tasks; maintenance runs as built-in schedules. Draining queued tasks is the caller's job // (drainLoop in Run, drainNATS in RunOnce) so there is one drainer. func (d *Daemon) Cycle(ctx context.Context) { + d.markPoll("") d.dispatchBindings(ctx) d.drainReactions(ctx) }