Leaderless scheduling and execution
Every outcrond instance runs the same scheduler loop. There is no elected leader, no queue broker, and no sidecar. Instances coordinate entirely through the database using compare-and-swap (CAS) operations and row-level locking.
Each poll cycle, every instance scans for schedules whose next_run_at has passed and attempts to advance it via an atomic CAS update. Only the instance that wins the CAS materializes execution slots for that schedule. A uniqueness constraint on (trigger_type, schedule_id, scheduled_for_at) guarantees exactly one execution row per scheduled slot, even if multiple instances race.
Pending executions are claimed through PostgreSQL's FOR UPDATE SKIP LOCKED, which lets instances claim distinct rows without contention or deadlocks. Each claimed execution runs in a bounded worker goroutine with configurable concurrency limits per executor.
Schedules support timezone-aware cron expressions with configurable misfire policies — skip missed slots, run the latest only, or catch up with a bounded backfill limit. A random splay of up to 45 seconds prevents thundering herds when many schedules fire at the same wall-clock minute.