mirror of
https://github.com/bitbaum/fleet.git
synced 2026-12-04 05:47:47 +01:00
The timer I installed an hour ago was active, enabled, and dead.
systemctl is-active -> active
systemctl is-enabled -> enabled
NextElapseUSecMonotonic -> infinity
OnBootSec=5min and OnUnitActiveSec=15min are MONOTONIC. It ran fine while it
was left alone, but I stopped it to investigate a false dispatch, and on
restart systemd had no next elapse to compute: OnBootSec's trigger point was
hours in the past, and OnUnitActiveSec re-arms from an activation the restarted
timer no longer had. Persistent=true does nothing for a monotonic timer, so it
did not save it either.
So the mechanism built to end "reports healthy, does nothing" failures was
itself one, and would have gone on saying `active` indefinitely while the fleet
stopped being reconciled. Caught only because I read NextElapse instead of
trusting the word `active`.
OnCalendar=*:0/15 is absolute — :00, :15, :30, :45, computable without
reference to boot time or to any previous run, and unaffected by stop/start.
Persistent=true is now meaningful and catches up a tick missed to downtime.
RandomizedDelaySec=45 keeps it off the exact quarter hour.
And the installer no longer reports success without proving the thing will
tick: it reads NextElapseUSecRealtime and fails if there is none. It caught this
class on its first run. The check retries briefly, because the property is not
populated the instant `enable --now` returns and a guard that false-alarms is a
guard that gets ignored.
Verified on bitbaum: next elapse 13:00:44 UTC, and the 12:54 tick dispatched a
run that proved its guards (24 + 34 assertions), surveyed 21 repos and correctly
dispatched nothing.
Claude-Session: https://claude.ai/code/session_01NLZ6vs1jsWw2kKbpWTZHf2
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
29 lines
1.3 KiB
SYSTEMD
29 lines
1.3 KiB
SYSTEMD
[Unit]
|
|
Description=Tick the fleet deploy reconciler every 15 minutes
|
|
|
|
[Timer]
|
|
# REALTIME, not monotonic, and that distinction bit immediately.
|
|
#
|
|
# The first version used OnBootSec=5min + OnUnitActiveSec=15min. It worked until
|
|
# the timer was stopped and started again — then `systemctl is-active` said
|
|
# active, `is-enabled` said enabled, and `NextElapseUSecMonotonic` said
|
|
# **infinity**: it would never have fired again. OnBootSec's trigger point was
|
|
# hours in the past, and OnUnitActiveSec re-arms from an activation that, after
|
|
# the restart, systemd no longer had. A clock that reports healthy and never
|
|
# ticks is the exact failure this whole mechanism exists to end, so it must not
|
|
# be the mechanism's own shape.
|
|
#
|
|
# OnCalendar is absolute: :00, :15, :30, :45 of every hour, computable without
|
|
# reference to boot time or to any previous run, and unaffected by stop/start.
|
|
OnCalendar=*:0/15
|
|
# Do not land on the quarter hour with every other cron in the world.
|
|
RandomizedDelaySec=45
|
|
# Only meaningful for a realtime timer — which is now what this is. After the
|
|
# box is down over a tick, run once on return rather than silently skipping it;
|
|
# a missed tick is how a merge stays un-deployed.
|
|
Persistent=true
|
|
Unit=fleet-reconciler.service
|
|
|
|
[Install]
|
|
WantedBy=timers.target
|