islco / django-rq-scheduler

A database backed job scheduler for Django RQ and RQ Scheduler
MIT License
42 stars 46 forks source link

Heroku restart ignores Scheduled time and starts the task #30

Open mastizada opened 5 years ago

mastizada commented 5 years ago

Heroku has a daily restart for its apps. Our Django-rq-scheduler tasks are starting right after each restart and also at the time that we added. Also, it even starts if enabled field is False.

How to check if it is django-rq-scheduler problem or django-rq or rq?

tom-price commented 5 years ago

I'm looking into this. Can you confirm the job type? I've currently fixing an issue w. repeatable jobs where on re-scheduling they can end up re-running the tasks.

mastizada commented 5 years ago

Hi @tom-price , they were "Repeatable Job"s added in django admin, as heroku dynos has a daily restart, at each restart tasks were automatically started ignored their scheduled time. We had to switch to appscheduler+django-rq, no it works as should be, but tasks cannot be managed in admin, we are planning to switch to celery, celery-beat and rabbitmq in near future for stability, better task statistics and flexibility.

"where on re-scheduling they can end up re-running the tasks" - yes, looks like it is the problem we had.

tom-price commented 5 years ago

Ahh I see. It do believe PR #34 addresses this issue. My understanding is when you schedule a task with a start time in the past using if there are remaining repeats then it tries to start running right away. The change made mentioned above essentially steps the scheduled time forwards in increments of the interval until there are either no repeats remaining or a new scheduled time in the future is arrived at.