File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ def __init__(
2727 retry_after_failure_mins = None ,
2828 run_weekly_on_days = None ,
2929 run_monthly_on_days = None ,
30+ run_tolerance_seconds = 0 ,
3031 ):
3132 if run_at_times is None :
3233 run_at_times = []
@@ -35,6 +36,7 @@ def __init__(
3536 self .retry_after_failure_mins = retry_after_failure_mins
3637 self .run_weekly_on_days = run_weekly_on_days
3738 self .run_monthly_on_days = run_monthly_on_days
39+ self .run_tolerance_seconds = run_tolerance_seconds
3840
3941
4042class CronJobBase (object ):
@@ -122,7 +124,7 @@ def should_run_now(self, force=False):
122124 if (
123125 last_job
124126 and not last_job .is_success
125- and get_current_time ()
127+ and get_current_time () + timedelta ( seconds = cron_job . schedule . run_tolerance_seconds )
126128 <= last_job .start_time
127129 + timedelta (minutes = cron_job .schedule .retry_after_failure_mins )
128130 ):
@@ -138,7 +140,7 @@ def should_run_now(self, force=False):
138140
139141 if self .previously_ran_successful_cron :
140142 if (
141- get_current_time ()
143+ get_current_time () + timedelta ( seconds = cron_job . schedule . run_tolerance_seconds )
142144 > self .previously_ran_successful_cron .start_time
143145 + timedelta (minutes = cron_job .schedule .run_every_mins )
144146 ):
You can’t perform that action at this time.
0 commit comments