mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-11 05:17:55 +03:00
Fixed "0" interval rules, that could hang UDS index page & consume all
memory
This commit is contained in:
parent
5af198db75
commit
5ce61e1f98
@ -109,6 +109,10 @@ class CalendarRules(DetailHandler): # pylint: disable=too-many-public-methods
|
||||
# We need this fields for all
|
||||
logger.debug('Saving rule {0} / {1}'.format(parent, item))
|
||||
fields = self.readFieldsFromParams(['name', 'comments', 'frequency', 'start', 'end', 'interval', 'duration', 'duration_unit'])
|
||||
|
||||
if int(fields['interval']) == 0:
|
||||
self.invalidItemException('Element can\'t have a 0 interval')
|
||||
|
||||
# Convert timestamps to datetimes
|
||||
fields['start'] = datetime.datetime.fromtimestamp(fields['start'])
|
||||
if fields['end'] != None:
|
||||
|
@ -46,7 +46,7 @@ import six
|
||||
import bitarray
|
||||
import logging
|
||||
|
||||
__updated__ = '2016-04-26'
|
||||
__updated__ = '2016-10-31'
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -85,7 +85,11 @@ class CalendarChecker(object):
|
||||
ruleDurationMinutes = rule.duration_as_minutes
|
||||
ruleFrequencyMinutes = rule.frequency_as_minutes
|
||||
|
||||
ruleDurationMinutes = ruleDurationMinutes
|
||||
# Skip "bogus" definitions
|
||||
if ruleDurationMinutes == 0 or ruleFrequencyMinutes == 0:
|
||||
continue
|
||||
|
||||
# ruleDurationMinutes = ruleDurationMinutes
|
||||
# Relative start, rrule can "spawn" the days, so we get the start at least the ruleDurationMinutes of rule to see if it "matches"
|
||||
# This means, we need the previous matching day to be "executed" so we can get the "actives" correctly
|
||||
diff = ruleFrequencyMinutes if ruleFrequencyMinutes > ruleDurationMinutes else ruleDurationMinutes
|
||||
|
Loading…
Reference in New Issue
Block a user