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

Add run tolerance #139

Closed Red-Teapot closed 2 years ago

Red-Teapot commented 6 years ago

Add run_tolerance_seconds parameter to Schedule class.

This parameter specifies time window (in seconds) to run the job.

Basically, value of the parameter gets added to current time in the code.

For example, consider a job that runs every 5 minutes and last time it was run at 00:00:00. For example, runcrons command gets called every five minutes starting from 00:00:00.

Without this parameter, the job will be run next time at 00:10:00.

If run_tolerance_seconds is set to non-zero value, the job will be run next time at 00:05:00. That makes job run period more precise.

By default, run_tolerance_seconds is 0, so this does not affect existing jobs.