phoneof/scheduler/scheduler.go
Elizabeth Hunt f163a24279
All checks were successful
continuous-integration/drone/push Build is passing
initial commit
2025-01-03 01:47:07 -08:00

35 lines
552 B
Go

package scheduler
import (
"database/sql"
"log"
"time"
"git.simponic.xyz/simponic/phoneof/args"
"github.com/go-co-op/gocron/v2"
)
func StartScheduler(_dbConn *sql.DB, argv *args.Arguments) {
scheduler, err := gocron.NewScheduler()
if err != nil {
panic("could not create scheduler")
}
_, err = scheduler.NewJob(
gocron.DurationJob(
24*time.Hour,
),
gocron.NewTask(
func(msg string) {
log.Println(msg)
},
"it's a beautiful new day!",
),
)
if err != nil {
panic("could not create job")
}
scheduler.Start()
}