carlos / platform Public

spread-every-schedule-ticks

Human

An every schedule is fanned out to every instance of an app and fired on the epoch-aligned boundary, so all instances woke in the same second and stayed resident together for one idle window (100 instances, every 1h, 15m window: 27 awake on average, 100 at the peak).

Each instance now fires at its own fixed offset into the period: sha256(host) modulo the period, stored in the row's spec text (every 1h offset 1234s) and added by Spec.Next. One instance's fires stay exactly one period apart, and the offset survives restarts, box moves and re-declaring. Spread is the default; carlos schedule set --aligned keeps the boundary. Cron and one-shots are untouched. carlos schedule ls marks each every schedule spread or aligned.

Upgrade: the first converge pass re-arms each old row at its spread time through the existing changed-spec path.

To know before merging:

  • Not yet run on a box (the 100-instance, 15m-window check from the spec).
  • A hash clumps: 100 hosts over 1h put 33 in the busiest 15 minutes, where even would be 25.
  • A box that predates the offset grammar cannot parse the new spec; upgrade the receiving side of a move or HA wake first.
  • every 24h no longer means midnight UTC; that needs --cron or --aligned.
  • Tests: internal/schedule, internal/timerspec, internal/registry and the CLI schedule/golden tests pass. Full internal/console, internal/host and root runs fail in the agent's sandbox with inappropriate ioctl for device in claim/DB tests; not confirmed against a clean checkout, so CI is the check.
Commits 5
Discussions 0 0 open
Tasks 0/0 done

Discussions

  • No discussions on this branch yet.

Tasks

  • No tasks yet.

Activity