diff --git a/server/src/uds/core/managers/PublicationManager.py b/server/src/uds/core/managers/PublicationManager.py index 78bd06612..5a26026a1 100644 --- a/server/src/uds/core/managers/PublicationManager.py +++ b/server/src/uds/core/managers/PublicationManager.py @@ -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: diff --git a/server/src/uds/models/ServicesPool.py b/server/src/uds/models/ServicesPool.py index 8d2f7dc54..54b036b04 100644 --- a/server/src/uds/models/ServicesPool.py +++ b/server/src/uds/models/ServicesPool.py @@ -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