-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: jitter on cron jobs #953
Conversation
job/job.go
Outdated
} | ||
j.entryID = &entryID | ||
} else { | ||
delaydJob := cron.FuncJob(func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the jitter should be once off at the start, i.e. delay the scheduling of the job by random(min(duration till next runtime, 1h))
d92feb3
to
249574c
Compare
ba6d8af
to
0ff8c4d
Compare
@moshloop I'm leaving off delaying the initial scheduling even though we discussed we would add a 100% jitter to it. The problem is that if we delay the scheduling by running If the job needs to be rescheduled (scraper CRD updated) when it's still waiting for first schedule, then it's not possible to unschedule is as we won't have the I think let's try with per iteration jitter for now and see how it goes? |
job/job.go
Outdated
delayPercent := rand.Intn(iterationJitterPercent) | ||
jitterDuration := time.Duration((int64(interval) * int64(delayPercent)) / 100) | ||
if jitterDuration > maxJitterDuration { | ||
jitterDuration = maxJitterDuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will have fixed 15m jitters, so if interval * delayPercent then interval = 15m
8c55f11
to
d30eabc
Compare
No description provided.