-
-
Notifications
You must be signed in to change notification settings - Fork 90
Description
As far as I know, current design of scheduler works like this:
- send all tasks that are scheduled to current minute
- wait until next minute start (while asynchronously keeping an eye on scheduled tasks)
- repeat send with delays with one minute interval
This creates a possible duplication of tasks. If I restart scheduler in a minute where there is a cron scheduled task, this task is sent twice (once before the restart and once after). On the other hand, it allows the scheduler to be restarted without missing a task, assuming the restart takes less then one minute to perform (which is quite reasonable assumption for scheduler).
Ideally, tasks should be idempotent, but that's not always possible. It would be great if taskiq kept in mind whether particular task has already been sent to worker queue in one minute and if so, wouldn't send it again after restart. This is obviously not possible with LabelScheduleSource
since it doesn't have any permanent storage, but it might be possible with taskiq_redis.RedisScheduleSource
.
What do you think about this? Should I propose an enhancement in taskiq_redis
? Does something need to be done in taskiq
itself?