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

second based scheduling isn't reliable #49

Open
bsutton opened this issue Dec 9, 2023 · 3 comments
Open

second based scheduling isn't reliable #49

bsutton opened this issue Dec 9, 2023 · 3 comments

Comments

@bsutton
Copy link
Contributor

bsutton commented Dec 9, 2023

As I understand it, the scheduler works by setting a timer to go off every second.

The problem with this is that in an async environment, a compute-heavy workload can result in the timer being delayed.

When doing a seconds-based schedule this can mean that the task may never be run as the scheduler checks that the current time = the schedule no. of seconds.

The result is that cron is unreliable for seconds based scheduling and may be unreliable for minutes based scheduling if a very heavy process is run.

Ideally, we need to guarantee that tasks are run, even if they are late.

@isoos
Copy link
Contributor

isoos commented Dec 9, 2023

Good points. Open for PRs :-)

@bsutton
Copy link
Contributor Author

bsutton commented Dec 9, 2023 via email

@busslina
Copy link

I'm using Cron to trigger certificate renewals.

Maybe for certificate renewals it is better to schedule one by one renewal (instead of using cron based scheduling) because with cron you are not taking care of the time spent in the renewal.

EG: If a certificate ends at 19:54:36, the next could end at 19:55:12.

So, yes, you can use a Cron based solution if you schedule it with some days of margin (like 85 days instead the default 89 days).

But at the end I agree with you. This lib should ensure the execution, even if it's late.

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

3 participants