Skip to content
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

Recurring jobs sometimes run immediately when added to queue #306

Closed
sbleon opened this issue Nov 5, 2020 · 6 comments
Closed

Recurring jobs sometimes run immediately when added to queue #306

sbleon opened this issue Nov 5, 2020 · 6 comments

Comments

@sbleon
Copy link
Contributor

sbleon commented Nov 5, 2020

Sometimes, when I add recurring jobs to a queue, starting with a completely empty Redis, an instance of the job is immediately executed. Has anyone else seen this happen?

@manast
Copy link
Contributor

manast commented Nov 5, 2020

Picture this: time is divided in slots separated by your repeating interval, the slots are fixed, they need to be so that all workers are in consensus on when the next repeatable job is supposed to be repeated. If you happen to add the recurring job very close to the next slot it will be executed directly.

@manast
Copy link
Contributor

manast commented Nov 5, 2020

btw, this is also the way standard cron jobs works AFAIK.

@5achinJani
Copy link

I did see this in #305 but in my case the redis was not empty flushing it resolved it.

@sbleon
Copy link
Contributor Author

sbleon commented Dec 24, 2020

Thanks, @manast . I somehow missed your timely response!

If you happen to add the recurring job very close to the next slot it will be executed directly.

If it is currently 12pm, and I schedule a job for 2am every day, that would not count as "very close to the next slot", right?

@manast
Copy link
Contributor

manast commented Dec 27, 2020

@sbleon no, that would not count.

@roggervalf
Copy link
Collaborator

Closing as we support using immediately param

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants