mirror of
https://github.com/ansible/awx.git
synced 2026-03-22 03:17:39 -02:30
improve detection of expensive DTSTART RRULE values
This commit is contained in:
@@ -150,14 +150,13 @@ class Schedule(CommonModel, LaunchTimeConfig):
|
|||||||
# > UTC time.
|
# > UTC time.
|
||||||
raise ValueError('RRULE UNTIL values must be specified in UTC')
|
raise ValueError('RRULE UNTIL values must be specified in UTC')
|
||||||
|
|
||||||
try:
|
if 'MINUTELY' in rrule or 'HOURLY' in rrule:
|
||||||
first_event = x[0]
|
try:
|
||||||
if first_event < now() - datetime.timedelta(days=365 * 5):
|
first_event = x[0]
|
||||||
# For older DTSTART values, if there are more than 1000 recurrences...
|
if first_event < now() - datetime.timedelta(days=365 * 5):
|
||||||
if len(x[:1001]) > 1000:
|
raise ValueError('RRULE values with more than 1000 events are not allowed.')
|
||||||
raise ValueError('RRULE values that yield more than 1000 events are not allowed.')
|
except IndexError:
|
||||||
except IndexError:
|
pass
|
||||||
pass
|
|
||||||
return x
|
return x
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user