mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-24 02:04:09 +03:00
Added a couple of logs due to the fact that maybe in some moment we
change a datetime from db/uds and may "force" tasks
This commit is contained in:
parent
b56b3ef6d8
commit
4271be9340
@ -45,7 +45,7 @@ import threading
|
||||
import time
|
||||
import logging
|
||||
|
||||
__updated__ = '2017-11-15'
|
||||
__updated__ = '2018-03-02'
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -107,6 +107,8 @@ class DelayedTaskRunner(object):
|
||||
try:
|
||||
with transaction.atomic(): # Encloses
|
||||
task = dbDelayedTask.objects.select_for_update().filter(filt).order_by('execution_time')[0] # @UndefinedVariable
|
||||
if task.insert_date > now + timedelta(seconds=30):
|
||||
logger.warn('EXecuted {} due to insert_date being in the future!'.format(task.type))
|
||||
taskInstanceDump = encoders.decode(task.instance, 'base64')
|
||||
task.delete()
|
||||
taskInstance = loads(taskInstanceDump)
|
||||
|
@ -144,6 +144,8 @@ class Scheduler(object):
|
||||
# If next execution is before now or last execution is in the future (clock changed on this server, we take that task as executable)
|
||||
# This params are all set inside fltr (look at __init__)
|
||||
job = dbScheduler.objects.select_for_update().filter(fltr).order_by('next_execution')[0] # @UndefinedVariable
|
||||
if job.last_execution > now:
|
||||
logger.warn('EXecuted {} due to last_execution being in the future!'.format(job.name))
|
||||
job.state = State.RUNNING
|
||||
job.owner_server = self._hostname
|
||||
job.last_execution = now
|
||||
|
Loading…
x
Reference in New Issue
Block a user