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

Fixed Assigned an unussed checker bug

This commit is contained in:
Adolfo Gómez García 2014-11-22 10:39:57 +01:00
parent 5261bff8ae
commit 3c91f6e62b

View File

@ -59,11 +59,11 @@ class AssignedAndUnused(Job):
osm = ds.osmanager.getInstance()
if osm.processUnusedMachines is True:
logger.debug('Processing unused services for {0}'.format(osm))
for us in ds.assignedUserServices().select().filter(in_use=False, state_date__lt=since_state, state=State.USABLE, os_state=State.USABLE):
for us in ds.assignedUserServices().filter(in_use=False, state_date__lt=since_state, state=State.USABLE, os_state=State.USABLE):
logger.debug('Found unused assigned service {0}'.format(us))
osm.processUnused(us)
else: # No os manager, simply remove unused services in specified time
with transaction.atomic():
for us in ds.assignedUserServices().select().filter(in_use=False, state_date__lt=since_state, state=State.USABLE, os_state=State.USABLE):
for us in ds.assignedUserServices().select_for_update().filter(in_use=False, state_date__lt=since_state, state=State.USABLE, os_state=State.USABLE):
logger.debug('Found unused assigned service {0}'.format(us))
us.remove()