feat: schedules move to cluster CronJobs #18

Merged
k.renner merged 1 commits from feat/external-schedules into main 2026-10-26 06:42:52 +00:00
Member

The service stops scheduling work itself; the cluster does (homelab PR follows).

  • New POST /api/v1/encyclopedia/run (Write policy): syncs, then runs the encyclopedia. 200 with the summary; 502 when the run fails or the text model stopped it (e.g. the API spend limit), so the CronJob's Job fails visibly; 503 when the encyclopedia is disabled. The run is not cancelled when the caller hangs up, only on shutdown.
  • Removed EncyclopediaBackgroundService and Encyclopedia:RunAt/TimeZone.
  • Sync: the 30-min interval loop is gone; SyncBackgroundService keeps the startup sync and the webhook trigger. The interval becomes a CronJob calling the existing POST /api/v1/sync. Wiki:Sync:IntervalSeconds/RetrySeconds removed.

Merge order: this first; the homelab PR (CronJobs, scheduler API key, network policy) after Flux rolled this image. Between the two merges no scheduled encyclopedia/interval sync runs; the webhook still syncs on every push.

Tests: 541 pass (Host 140: the scheduler tests replaced by endpoint tests for 401, 503, 200-after-sync, 502 on failure, 502 on model stop).

🤖 Generated with Claude Code

The service stops scheduling work itself; the cluster does (homelab PR follows). - **New** `POST /api/v1/encyclopedia/run` (Write policy): syncs, then runs the encyclopedia. 200 with the summary; 502 when the run fails or the text model stopped it (e.g. the API spend limit), so the CronJob's Job fails visibly; 503 when the encyclopedia is disabled. The run is not cancelled when the caller hangs up, only on shutdown. - **Removed** `EncyclopediaBackgroundService` and `Encyclopedia:RunAt`/`TimeZone`. - **Sync:** the 30-min interval loop is gone; `SyncBackgroundService` keeps the startup sync and the webhook trigger. The interval becomes a CronJob calling the existing `POST /api/v1/sync`. `Wiki:Sync:IntervalSeconds`/`RetrySeconds` removed. Merge order: this first; the homelab PR (CronJobs, scheduler API key, network policy) after Flux rolled this image. Between the two merges no scheduled encyclopedia/interval sync runs; the webhook still syncs on every push. Tests: 541 pass (Host 140: the scheduler tests replaced by endpoint tests for 401, 503, 200-after-sync, 502 on failure, 502 on model stop). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
claude-bot added 1 commit 2026-10-26 06:35:36 +00:00
feat: schedules move to cluster CronJobs
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
61c424aac6
The service no longer schedules work itself. POST /api/v1/encyclopedia/run
syncs and runs the encyclopedia; it answers 502 when the run fails or the
text model stopped it, so a CronJob shows a failed run as a failed Job.
The sync loop keeps its startup sync and the webhook trigger; the 30-min
interval is a CronJob calling POST /api/v1/sync.

Removed: EncyclopediaBackgroundService, Encyclopedia RunAt/TimeZone,
Wiki:Sync IntervalSeconds/RetrySeconds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
k.renner merged commit e66e2ad250 into main 2026-10-26 06:42:52 +00:00
k.renner deleted branch feat/external-schedules 2026-10-26 06:42:52 +00:00
Sign in to join this conversation.