Duplicate jobs getting scheduled with croniter 0.3.22
manango opened this issue · comments
It looks like croniter 0.3.22
was released very recently. With that version, croniter.get_next()
API behavior changed (looks like a bug) compared to 0.3.20
version. See taichino/croniter#102.
Due to above croniter issue, if scheduler is running with less than 60 seconds interval, then there is possibility that scheduler incorrectly schedules "cron" based same job multiple times.
As an example, with croniter 0.3.22, let's say the job has cron configuration of '0,30 * * * *'
(i.e. job is run at every 0 and 30 minutes). And let's say scheduler interval is 30 seconds. In that case:
Scheduler Run Time | Scheduler Ran The Job? | Next Job Schedule Time
-----------------------------------------------------------------------------
08:58:40 | No | 09:00:00
08:59:10 | No | 09:00:00
08:59:40 | No | 09:00:00
09:00:10 | Yes | 09:00:00 <- Since croniter.get_next() returns 09:00:00, job gets scheduled again at 9:00:00 incorrectly
09:00:40 | Yes | 09:00:00 <- Since croniter.get_next() returns 09:00:00, job gets scheduled again at 9:00:00 incorrectly
09:01:10 | Yes | 09:30:00
09:01:40 | No | 09:30:00
Fixed in taichino/croniter#103