-
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
Didn't add any delay but there is delay in job execution #276
Comments
Sorry, I'm having trouble exactly understanding the scenario. Can you provide code for me to replicate what you're doing? |
i hava the same question for this issue.When i deploy my cron service in docker, after i reboot the server, there is a time interval before the first cron job. I had tried to fix it by change the time zone, but didn't make it. if anything could help me to slove the problem, please tell me, thanks a lot :) Env:
CornVersion:
BuilderImg:
DeploymentImg:
Code: import (
......
_ "time/tzdata"
)
func JobTimer() {
c := cron.New()
// when the cron service start, log the container time and timezone info
Logger.Info("[定时器]", zap.Time("运行时间", time.Now()), zap.String("时区", c.Location().String()))
// add a cron job, the CommitTime is a const var -> "00 7,12 * * *"
eid, err := c.AddFunc(CommitTime, func() {
// my custom job, i make sure nothing will block the goroutine
go Job()
...
// and after the job finished, print when the next job will do
for _, entry := range c.Entries() {
Logger.Info("[GHC定时器]", zap.Time("下一次执行时间", entry.Schedule.Next(time.Now())))
}
})
if err != nil {
Logger.Error("[定时任务错误]", zap.Error(err))
return
}
// this func will print the next job will do also
Logger.Info("[GHC定时器]", zap.Time("下一次执行时间", c.Entry(eid).Schedule.Next(time.Now())))
c.Run()
} Log:
maybe the problem caused by reboot? |
I am using robfig V2 on golang v1.10. I have a job that is executed every 5 mins. I have around 2k jobs to be started at once. Now when it starts, I did not add any custom delay but second execution for some job (that should be done after 5-10 mins approx) occurred after 30 mins which is a big difference. Can you help me over this ?
The text was updated successfully, but these errors were encountered: