mirror of
https://github.com/bitbaum/orangecat.git
synced 2026-12-04 04:37:14 +01:00
Caught by checking production rather than by reading the code: the queue had deployed, and the Cat still had no account. Following that through, it never would have got one. The circularity: resolveMentions can only flag @cat when a Cat PROFILE exists, so with no account nothing is ever queued — and the worker called ensureCatAccount AFTER its empty-queue early return, so an empty queue established nothing. Nothing queued, so nothing was established, so nothing queued. A freshly deployed platform would sit there with @cat resolving to nobody, looking exactly like a working feature that nobody had used yet. The worker now establishes the account before it looks at the queue. One primary-key lookup per tick when it is a no-op, which is every tick after the first, and the every-minute timer therefore becomes what brings the Cat into existence. Second half of the same bug, in the timer: `Persistent=true` only replays a run MISSED while the machine was down. A timer enabled for the first time just waits for the next OnCalendar — for a daily timer, up to 24 hours. Production confirmed it: the unit was installed and enabled, LAST was "-", NEXT was 12 hours away. OnActiveSec=1min makes a freshly deployed Cat exist within the minute. Pinned by a test that asserts the ORDERING, not just the call, and proven by restoring the old arrangement — two tests go red. Co-authored-by: Georgy Butaev <41178744+g-but@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
24 lines
963 B
SYSTEMD
24 lines
963 B
SYSTEMD
# SSOT: repo scripts/systemd/ — installed by deploy-selfhost.sh.
|
|
# Instance of the generic orangecat-cron@.service template (curls
|
|
# /api/cron/cat-account with CRON_SECRET).
|
|
#
|
|
# Asserts that the Cat has a profile. @cat is linked wherever it is written, so
|
|
# a missing account makes every mention resolve to nobody — daily re-assertion
|
|
# turns that from a support ticket into a self-healing invariant.
|
|
[Unit]
|
|
Description=OrangeCat Cat account invariant (daily)
|
|
|
|
[Timer]
|
|
# OnActiveSec is what makes a freshly deployed Cat exist within the minute.
|
|
# `Persistent=true` only replays a run MISSED while the machine was down; a
|
|
# timer enabled for the first time simply waits for the next OnCalendar, which
|
|
# for a daily timer is up to 24 hours away. That gap is not cosmetic — until the
|
|
# account exists, @cat resolves to nobody and nothing can be queued.
|
|
OnActiveSec=1min
|
|
OnCalendar=daily
|
|
Persistent=true
|
|
RandomizedDelaySec=15m
|
|
|
|
[Install]
|
|
WantedBy=timers.target
|