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

fixed cache 2 -> 1

This commit is contained in:
Adolfo Gómez García 2019-05-08 11:34:55 +02:00
parent c47501e3e6
commit d6935d0210
2 changed files with 4 additions and 3 deletions

View File

@ -51,7 +51,7 @@ import requests
import json import json
import logging import logging
__updated__ = '2019-02-26' __updated__ = '2019-05-08'
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
traceLogger = logging.getLogger('traceLog') traceLogger = logging.getLogger('traceLog')
@ -188,6 +188,7 @@ class UserServiceManager(object):
ci = cache.getInstance() ci = cache.getInstance()
state = ci.moveToCache(cacheLevel) state = ci.moveToCache(cacheLevel)
cache.cache_level = cacheLevel cache.cache_level = cacheLevel
cache.save(update_fields=['cache_level'])
logger.debug('Service State: {0} {1} {2}'.format(State.toString(state), State.toString(cache.state), State.toString(cache.os_state))) logger.debug('Service State: {0} {1} {2}'.format(State.toString(state), State.toString(cache.state), State.toString(cache.os_state)))
if State.isRuning(state) and cache.isUsable(): if State.isRuning(state) and cache.isUsable():
cache.setState(State.PREPARING) cache.setState(State.PREPARING)

View File

@ -40,7 +40,7 @@ from uds.models import UserService
import logging import logging
__updated__ = '2019-02-24' __updated__ = '2019-05-08'
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -65,7 +65,7 @@ class StateUpdater(object):
if newState is not None: if newState is not None:
self.userService.setState(newState) # This saves state & state_date self.userService.setState(newState) # This saves state & state_date
self.userService.updateData(self.userServiceInstance) # This saves data self.userService.updateData(self.userServiceInstance) # This saves data
# self.userService.save(update_fields=['data', 'state', 'state_date']) self.userService.save(update_fields=['state', 'state_date'])
def checkLater(self): def checkLater(self):
UserServiceOpChecker.checkLater(self.userService, self.userServiceInstance) UserServiceOpChecker.checkLater(self.userService, self.userServiceInstance)