|
@@ -21,8 +21,8 @@ from . import current_app
|
|
|
from .five import range, string_t
|
|
|
from .utils import is_iterable
|
|
|
from .utils.timeutils import (
|
|
|
- timedelta_seconds, weekday, maybe_timedelta, remaining,
|
|
|
- humanize_seconds, timezone, maybe_make_aware, ffwd
|
|
|
+ weekday, maybe_timedelta, remaining, humanize_seconds,
|
|
|
+ timezone, maybe_make_aware, ffwd
|
|
|
)
|
|
|
from .datastructures import AttributeDict
|
|
|
|
|
@@ -116,7 +116,7 @@ class schedule(object):
|
|
|
"""
|
|
|
last_run_at = self.maybe_make_aware(last_run_at)
|
|
|
rem_delta = self.remaining_estimate(last_run_at)
|
|
|
- remaining_s = timedelta_seconds(rem_delta)
|
|
|
+ remaining_s = max(rem_delta.total_seconds(), 0)
|
|
|
if remaining_s == 0:
|
|
|
return schedstate(is_due=True, next=self.seconds)
|
|
|
return schedstate(is_due=False, next=remaining_s)
|
|
@@ -142,7 +142,7 @@ class schedule(object):
|
|
|
|
|
|
@property
|
|
|
def seconds(self):
|
|
|
- return timedelta_seconds(self.run_every)
|
|
|
+ return max(self.run_every.total_seconds(), 0)
|
|
|
|
|
|
@property
|
|
|
def human_seconds(self):
|
|
@@ -562,11 +562,11 @@ class crontab(schedule):
|
|
|
|
|
|
"""
|
|
|
rem_delta = self.remaining_estimate(last_run_at)
|
|
|
- rem = timedelta_seconds(rem_delta)
|
|
|
+ rem = max(rem_delta.total_seconds(), 0)
|
|
|
due = rem == 0
|
|
|
if due:
|
|
|
rem_delta = self.remaining_estimate(self.now())
|
|
|
- rem = timedelta_seconds(rem_delta)
|
|
|
+ rem = max(rem_delta.total_seconds(), 0)
|
|
|
return schedstate(due, rem)
|
|
|
|
|
|
def __eq__(self, other):
|