fix an rrule bug that causes improper HOURLY/MINUTELY calculation

see: https://github.com/ansible/awx/issues/8071
This commit is contained in:
Ryan Petrello
2020-09-18 10:29:46 -04:00
parent 56c5a39087
commit bf1d93168b
2 changed files with 60 additions and 3 deletions

View File

@@ -205,10 +205,15 @@ class Schedule(PrimordialModel, LaunchTimeConfig):
'A valid TZID must be provided (e.g., America/New_York)'
)
if fast_forward and ('MINUTELY' in rrule or 'HOURLY' in rrule):
if (
fast_forward and
('MINUTELY' in rrule or 'HOURLY' in rrule) and
'COUNT=' not in rrule
):
try:
first_event = x[0]
if first_event < now():
# If the first event was over a week ago...
if (now() - first_event).days > 7:
# hourly/minutely rrules with far-past DTSTART values
# are *really* slow to precompute
# start *from* one week ago to speed things up drastically