How do scheduled and background jobs run? #68
Notifications
Due Date
No due date set.
Blocks
Reference: bobby/hapi#68
Reference in new issue
Block a user
Part of #44
Question
What runs recurring and background work in v1 (a worker Deployment, k8s CronJobs invoking
hapisubcommands, or in-process scheduling), which v1 jobs exist (Job purge, Maintenance due checks, Token-expiry checks, anything Finance needs), how cross-Person work runs under RLS without a bypass role, and how it fits ADR-0004's connection budget and ADR-0009's Kuma push monitoring?Context carried from the map: background jobs / recurring schedules (Maintenance Task reminders, bill-due reminders for Banked Finance Categories, periodic syncs, purging finished Jobs older than 90 days). Shape depends on the domain MVPs. Constraints: cross-Person jobs run once per Person under RLS; there is no bypass role; any worker process shares the ~46-connection budget with app pods (ADR-0004).
Resolution: scheduled and background work
Kubernetes CronJobs run
hapi <subcommand>from the app image, as a tokenlessschedulerBot. There's no worker, no queue and no outbox: scheduled checks write durable Notifications. See ADR-0012.hapi jobs sweepevery 15 min marks expired Jobs and deletes finished Jobs older than 90 days (replaceshapi jobs purge; reads deriveexpireduntil it runs). Notification checks are CronJobs runninghapi notify <check>, and their content is left to How does hAPI send notifications through ntfy?. Not scheduled: purging a removed Person (on-demand CLI), Finance rollover and Banked carry-forward (computed on read),date_review(set at ingest), backups (the backups ticket).schedulerBot (created by a migration, can never hold a Token, gets Household grants from the Owner CLI, and shows up in Recorded by). Personal data → once per Person withhapi.principal_id= that Person, read-only. Rejected:hapi_migratorin a recurring pod, and Bindings for the scheduler.concurrencyPolicy: Forbid. Rule: app pods (with surge) × 10 + concurrent CronJobs × 1 + ~6 ≤ 46.kube_cronjob_status_last_successful_time). Kuma push is kept only for jobs that must be caught even when the cluster is down (importer, backups).deploy/feeds the app config andspec.timeZoneon calendar CronJobs. Interval jobs ignore it.Glossary: Notification added; Bot now notes built-in Bots that never hold a Token.