Tivix / django-cron

Write cron business logic as a Python class and let this app do the rest! It enables Django projects to schedule cron tasks, tracks their success / failures, manages contention (via a cache) etc. Basically takes care of all the boring work for you :-)
www.tivix.com
MIT License
900 stars 193 forks source link

retry_after_failure_mins not respected when only run_at_times is set #115

Closed MaZZly closed 3 years ago

MaZZly commented 7 years ago

Sample cronjob:

class FailingCronJob(CronJobBase):
    schedule = Schedule(run_at_times=['00:00'], retry_after_failure_mins=30)
    code = 'sample.failing'

    def do(self):
        failing_code()

This cronjob will run every minute because the check for retry_after_failure_mins is not run unless run_every_mins is specified.

Potential workaround is to set run_every_mins to large value that it would never trigger.. Altough this seems rather hacky, and a check for retry_after_failure_mins should be done when using run_at_times as well