backup-notify/scheduler/scheduler.go
Elizabeth Hunt bef72712c2
All checks were successful
continuous-integration/drone/push Build is passing
every hour delete and drone fixes
2024-04-21 18:49:41 -07:00

18 lines
331 B
Go

package scheduler
import (
"database/sql"
"time"
"git.simponic.xyz/simponic/backup-notify/database"
"github.com/go-co-op/gocron"
)
func StartScheduler(dbConn *sql.DB) {
scheduler := gocron.NewScheduler(time.Local)
scheduler.Every(1).Hour().Do(func() {
database.DeleteOldBackups(dbConn, 31)
})
scheduler.StartAsync()
}