mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-05 09:17:54 +03:00
Fixed background "cleaners"
This commit is contained in:
parent
19edf417ba
commit
31ee1d2858
@ -66,7 +66,7 @@ class AssignedService(DetailHandler):
|
||||
'id_deployed_service': item.deployed_service.uuid,
|
||||
'unique_id': item.unique_id,
|
||||
'friendly_name': item.friendly_name,
|
||||
'state': item.state if not props.get('destroy_after') else State.CANCELING,
|
||||
'state': item.state if not (props.get('destroy_after') and item.state == State.PREPARING) else State.CANCELING,
|
||||
'os_state': item.os_state,
|
||||
'state_date': item.state_date,
|
||||
'creation_date': item.creation_date,
|
||||
|
@ -60,7 +60,7 @@ class HangedCleaner(Job):
|
||||
hanged = Count(
|
||||
'userServices',
|
||||
filter=Q(userServices__state_date__lt=since_state, userServices__state=State.PREPARING) |
|
||||
Q(userServices__state_date__lt=since_state, state=State.USABLE, userServices__os_state=State.PREPARING)
|
||||
Q(userServices__state_date__lt=since_state, userServices__state=State.USABLE, userServices__os_state=State.PREPARING)
|
||||
)
|
||||
).exclude(hanged=0).exclude(osmanager=None).exclude(service__provider__maintenance_mode=True).filter(state=State.ACTIVE)
|
||||
|
||||
|
@ -43,15 +43,14 @@ from uds.core.util import log
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
MAX_STUCK_TIME = 3600 * 24 * 2 # At most 2 days "Stuck", not configurable (there is no need to)
|
||||
|
||||
MAX_STUCK_TIME = 3600 * 24 # At most 1 days "Stuck", not configurable (there is no need to)
|
||||
|
||||
class StuckCleaner(Job):
|
||||
"""
|
||||
Kaputen Cleaner is very similar to Hanged Cleaner
|
||||
We keep it in a new place to "control" more specific thins
|
||||
"""
|
||||
frecuency = 3600 * 24 # Executes Once a day
|
||||
frecuency = 3601 * 8 # Executes Once a day
|
||||
friendly_name = 'Stuck States cleaner'
|
||||
|
||||
def run(self):
|
||||
|
@ -231,6 +231,7 @@ class LinuxOsManager(osmanagers.OSManager):
|
||||
This function can update userService values. Normal operation will be remove machines if this state is not valid
|
||||
"""
|
||||
if self.isRemovableOnLogout(userService):
|
||||
log.doLog(userService, log.INFO, 'Unused user service for too long. Removing due to OS Manager parameters.', log.OSMANAGER)
|
||||
userService.remove()
|
||||
|
||||
def isPersistent(self):
|
||||
|
@ -264,6 +264,7 @@ class WindowsOsManager(osmanagers.OSManager):
|
||||
This function can update userService values. Normal operation will be remove machines if this state is not valid
|
||||
"""
|
||||
if self.isRemovableOnLogout(userService):
|
||||
log.doLog(userService, log.INFO, 'Unused user service for too long. Removing due to OS Manager parameters.', log.OSMANAGER)
|
||||
userService.remove()
|
||||
|
||||
def isPersistent(self):
|
||||
|
Loading…
Reference in New Issue
Block a user