-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
context in cron.Job.Run Is it possible? #318
Comments
The Example implementation cron.New().AddFunc("", function (context c.Context) {
request.Context(context)
}) Example source code change func (c *Cron) AddFunc(spec string, cmd func(context c.Context)) error {
return c.AddJob(spec, FuncJob(cmd))
} |
robfig dipped out, dis abandonware ☠️ |
Based on this project, I forked a project and kept the record of original historical submissions. At the same time, the 4.x version is under development, and if you are interested, you can join it together.
ex: package main
import (
"context"
"github.com/flc1125/go-cron/v4"
"github.com/flc1125/go-cron/v4/middleware/recovery"
)
func main() {
c := cron.New()
c.Use(recovery.New())
c.AddFunc("* * * * * ?", func(ctx context.Context) error {
panic("YOLO")
})
c.Start()
defer c.Stop()
} |
V4.0.0 has been released, welcome to use it.👏🏻 |
I want to pass in the context in cron.Job.Run, is there any way?
The text was updated successfully, but these errors were encountered: