Prevent premature scheduler shutdown

This commit is contained in:
GHOSCHT 2024-12-31 14:14:22 +01:00
parent 7041b8672f
commit 863bd6fb6e
Signed by: ghoscht
GPG key ID: 2C2C1C62A5388E82

13
main.go
View file

@ -159,6 +159,7 @@ func main() {
gocron.WithSingletonMode(gocron.LimitModeReschedule),
)
if err != nil {
fmt.Println("Error creating task")
panic(err)
}
@ -167,14 +168,8 @@ func main() {
fmt.Print("Starting scheduler...\n\n")
// block until you are ready to shut down
select {
case <-time.After(time.Minute):
}
// when you're done, shut it down
err = s.Shutdown()
if err != nil {
panic(err)
// sleep for infinity and respond to scheduled tasks
for {
time.Sleep(infinityDuration)
}
}