From 154abc0c5016635ad3af49a0772a97fbdc34bedb Mon Sep 17 00:00:00 2001 From: Jan Wolff Date: Fri, 12 Sep 2025 10:17:45 +0200 Subject: qrcode, automated cleanup --- controller/app.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'controller/app.go') diff --git a/controller/app.go b/controller/app.go index f145ce2..c22f165 100644 --- a/controller/app.go +++ b/controller/app.go @@ -3,7 +3,9 @@ package controller import ( "embed" "html/template" + "log" "net/http" + "time" "drop.janw.name/config" "drop.janw.name/storage" @@ -37,3 +39,16 @@ func (app App) requireAuth(res http.ResponseWriter, req *http.Request) bool { return false } + +func (app *App) StartScheduler() { + log.Println("starting scheduler") + + go func() { + for true { + time.Sleep(time.Minute * 13) + + log.Println("running scheduled tasks") + app.storage.GarbageCollect() + } + }() +} -- cgit v1.2.3