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
901 stars 195 forks source link

get_time_until_run in core.py gives an error #241

Open GerardNL opened 1 year ago

GerardNL commented 1 year ago

I've been using the django_cron for scheduled jobs and it's working pretty well. While looking at getting a status back from the jobs, I tried to use the function "get_time_until_run" in the CronJobBase class.

However, "cls.schedule.run_every_mins" (line 73) will give an error if the job is scheduled to run at fixed hours, instead of at certain intervals.

Not a big issue, but I think a simple if-statement could catch it at least?

something like (to be inserted before line 67:

if cls.schedule.run_every_mins == None:
      return timedelta()

that way it will at least not error.