summaryrefslogtreecommitdiff
path: root/cmd/dashboard/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/dashboard/main.go')
-rw-r--r--cmd/dashboard/main.go7
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)