Open flc1125 opened 2 weeks ago
ex:
package main import ( "context" "log" "time" "github.com/flc1125/go-cron/v4" "github.com/flc1125/go-cron/v4/middleware/recovery" ) func main() { c := cron.New( cron.WithSeconds(), cron.WithMiddleware( recovery.New(), ), ) c.AddFunc("* * * * * *", func(ctx context.Context) error { log.Println("hello") return nil }) c.AddFunc("* * * * * *", func(ctx context.Context) error { log.Println("world") return nil }, cron.WithName("world")) c.Start() defer c.Stop() time.Sleep(time.Second * 10) }
ex: