Register the weekly suggestions schedule (Feature 20)
suggest.Service.WeeklySchedule fires at the household suggestions_dow and suggestions_time (default Sunday 08:00) with period key suggestions_weekly:YYYY-Www and starts a scheduled batch through the same service and job as the API, via the new StartScheduledBatch(week). StartBatch now refuses the scheduled trigger. new_suggestions is still emitted only where Feature 19 put it, in the transaction that stores a batch's Side quests. A scheduled batch is now keyed new_suggestions:YYYY-Www by the week carried in its job, so a batch caught up late keeps its own week's key; a manual batch stays keyed by its id. The title counts the new Side quests. A batch whose AI call fails stores nothing and sends nothing; the failure is in ai_runs. Fake-clock tests in internal/scheduler cover one batch and one notification per week, settings-driven fire time, AI failure, restart, late catch-up and a batch already under way. Maestro task 459aab71-5c3d-4853-9855-236a3602b1e0 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -192,6 +192,9 @@ func run(cfg config.Config, logger *slog.Logger) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := sched.Register(suggestSvc.WeeklySchedule()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
router, err := server.NewRouter(logger, version, cfg.TrustedProxy, authFlow, sessions, settings, search, ai, chatSvc, dinnerSvc, suggestSvc, planSvc, shopSvc, googleSvc, pushSvc, ideasSvc, runner, photos, frontend.Assets())
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user