diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-07-14 20:30:16 +0000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-07-16 02:44:32 +0000 |
| commit | ba5205213f6f1995ca4e64b08925bcc6c48b8211 (patch) | |
| tree | 7d8fbaa6c2007d8582252d7b1e417ce003566caa /cmd/dashboard | |
| parent | 550ffde0d8b71be96a4d21d7c07b718f367c2c48 (diff) | |
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.
Diffstat (limited to 'cmd/dashboard')
| -rw-r--r-- | cmd/dashboard/main.go | 7 |
1 files changed, 7 insertions, 0 deletions
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) |
