1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-03 01:17:56 +03:00

Fixed datetime.now

This commit is contained in:
Adolfo Gómez García 2018-06-21 12:55:17 +02:00
parent c72a6a32dc
commit d60f1d82db
2 changed files with 3 additions and 3 deletions

View File

@ -86,6 +86,7 @@ class PublicationLauncher(DelayedTask):
def run(self):
logger.debug('Publishing')
try:
now = getSqlDatetime()
with transaction.atomic():
servicePoolPub = DeployedServicePublication.objects.select_for_update().get(pk=self._publishId)
if servicePoolPub.state != State.LAUNCHING: # If not preparing (may has been canceled by user) just return
@ -96,7 +97,7 @@ class PublicationLauncher(DelayedTask):
state = pi.publish()
deployedService = servicePoolPub.deployed_service
deployedService.current_pub_revision += 1
deployedService.storeValue('toBeReplacedIn', pickle.dumps(datetime.datetime.now() + datetime.timedelta(hours=GlobalConfig.SESSION_EXPIRE_TIME.getInt(True))))
deployedService.storeValue('toBeReplacedIn', pickle.dumps(now + datetime.timedelta(hours=GlobalConfig.SESSION_EXPIRE_TIME.getInt(True))))
deployedService.save()
PublicationFinishChecker.checkAndUpdateState(servicePoolPub, pi, state)
except Exception:

View File

@ -62,7 +62,7 @@ import logging
import pickle
import six
__updated__ = '2018-03-14'
__updated__ = '2018-06-21'
logger = logging.getLogger(__name__)
@ -206,7 +206,6 @@ class DeployedService(UUIDModel, TaggingMixin):
return self.service is not None and self.service.isInMaintenance()
def toBeReplaced(self):
# return datetime.now()
activePub = self.activePublication()
if activePub is None or activePub.revision == self.current_pub_revision - 1:
return None