mirror of
https://github.com/ansible/awx.git
synced 2026-05-20 07:17:40 -02:30
don't allow distant DTSTART values for schedules; it's slow
see: https://github.com/ansible/ansible-tower/issues/7869
This commit is contained in:
@@ -166,6 +166,15 @@ class Schedule(CommonModel, LaunchTimeConfig):
|
||||
rrule = rrule.replace(match_until.group('until'), 'UNTIL={}'.format(utc))
|
||||
kwargs['tzinfos']['TZI'] = timezone
|
||||
x = dateutil.rrule.rrulestr(rrule, **kwargs)
|
||||
|
||||
try:
|
||||
first_event = x[0]
|
||||
if first_event < now() - datetime.timedelta(days=365 * 5):
|
||||
# For older DTSTART values, if there are more than 1000 recurrences...
|
||||
if len(x[:1001]) > 1000:
|
||||
raise ValueError('RRULE values that yield more than 1000 events are not allowed.')
|
||||
except IndexError:
|
||||
pass
|
||||
return x
|
||||
|
||||
def __unicode__(self):
|
||||
|
||||
Reference in New Issue
Block a user