We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I just encountered a runtime error, the logs is as below:
goroutine 1526 [running]: log.(*Logger).Panic(0xc0005440f0, 0xc000467c00, 0x3, 0x3) /Users/smy/sdk/go1.13.8/src/log/log.go:212 +0xaa github.com/bamzi/jobrunner.(*Job).Run.func1() /Users/smy/go/pkg/mod/github.com/bamzi/[email protected]/jobrunner.go:55 +0x1a5 panic(0xe86880, 0x1804d70) /Users/smy/sdk/go1.13.8/src/runtime/panic.go:679 +0x1b2 main.UpdateNews.Run() /Users/smy/go/src/GBlog/main.go:29 +0x89 github.com/bamzi/jobrunner.(*Job).Run(0xc0000a7090) /Users/smy/go/pkg/mod/github.com/bamzi/[email protected]/jobrunner.go:75 +0x188 github.com/robfig/cron/v3.(*Cron).startJob.func1(0xc000248b40, 0x10f8a80, 0xc0000a7090) /Users/smy/go/pkg/mod/github.com/robfig/cron/[email protected]/cron.go:307 +0x69 created by github.com/robfig/cron/v3.(*Cron).startJob /Users/smy/go/pkg/mod/github.com/robfig/cron/[email protected]/cron.go:305 +0x73 ^[[97;45m[JobRunner] 2020/09/07 - 09:14:54 Started... ^[[0m
my code is simple as send a http get request in a every 5min job:
func (e UpdateNews) Run() { resp, err := http.Get("https://sample_site.com/common/update_news/") if err != nil { fmt.Println("Call update news failed") } var res map[string]interface{} json.NewDecoder(resp.Body).Decode(&res) resCode := fmt.Sprintf("%v", res["code"]) if resCode == "0" { fmt.Printf("Every 5 mins update news success.") } } func main(){ jobrunner.Start() // optional: jobrunner.Start(pool int, concurrent int) (10, 1) err := jobrunner.Schedule("@every 300s", UpdateNews{}) if err != nil { panic(err) } }
The text was updated successfully, but these errors were encountered:
You need to declare UpdateNews{}
UpdateNews{}
type UpdateNews struct {}
Also the error response from jobrunner.Schedule... is related to parsing of cron. Maybe 300s should 5m
jobrunner.Schedule...
Sorry, something went wrong.
No branches or pull requests
I just encountered a runtime error, the logs is as below:
my code is simple as send a http get request in a every 5min job:
The text was updated successfully, but these errors were encountered: