From ba5205213f6f1995ca4e64b08925bcc6c48b8211 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Tue, 14 Jul 2026 20:30:16 +0000 Subject: feat(tasks): add periodic due-date check for recurring tasks A recurring task's successor now also gets created once its due date passes, independent of completion -- an ignored/overdue recurring task no longer blocks the next occurrence from appearing. Runs every 15 minutes via a new goroutine in main.go, cancelled on shutdown. --- cmd/dashboard/main.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'cmd/dashboard/main.go') diff --git a/cmd/dashboard/main.go b/cmd/dashboard/main.go index 72fe78e..45a83e2 100644 --- a/cmd/dashboard/main.go +++ b/cmd/dashboard/main.go @@ -22,6 +22,7 @@ import ( "task-dashboard/internal/config" "task-dashboard/internal/handlers" appmiddleware "task-dashboard/internal/middleware" + "task-dashboard/internal/scheduler" "task-dashboard/internal/store" "github.com/go-webauthn/webauthn/webauthn" @@ -392,6 +393,11 @@ func main() { IdleTimeout: 60 * time.Second, } + // Periodic recurring-task due-date check (independent of the HTTP + // server's own lifecycle, cancelled alongside it on shutdown below). + schedulerCtx, cancelScheduler := context.WithCancel(context.Background()) + go scheduler.RunRecurrenceCheck(schedulerCtx, db, 15*time.Minute) + // Graceful shutdown go func() { log.Printf("Starting server on http://localhost%s", addr) @@ -406,6 +412,7 @@ func main() { <-quit log.Println("Shutting down server...") + cancelScheduler() // Graceful shutdown with timeout ctx, cancel := context.WithTimeout(context.Background(), config.GracefulShutdownTimeout) -- cgit v1.2.3