Support for seconds in cron expressions
This commit is contained in:
parent
48e4aeb3dc
commit
bcd3bf7911
1 changed files with 5 additions and 2 deletions
|
@ -28,9 +28,12 @@ class Cronjob(Thread):
|
||||||
|
|
||||||
|
|
||||||
def should_run(self):
|
def should_run(self):
|
||||||
units = ('minute', 'hour', 'day', 'month', 'year')
|
|
||||||
now = datetime.datetime.fromtimestamp(time.time())
|
|
||||||
cron_units = re.split('\s+', self.cron_expression)
|
cron_units = re.split('\s+', self.cron_expression)
|
||||||
|
units = ('second', 'minute', 'hour', 'day', 'month', 'year') \
|
||||||
|
if len(cron_units) > 5 else \
|
||||||
|
('minute', 'hour', 'day', 'month', 'year')
|
||||||
|
|
||||||
|
now = datetime.datetime.fromtimestamp(time.time())
|
||||||
|
|
||||||
for i in range(0, len(units)):
|
for i in range(0, len(units)):
|
||||||
unit = units[i]
|
unit = units[i]
|
||||||
|
|
Loading…
Reference in a new issue