mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Remove active tasks when server is deleted
This commit is contained in:
parent
b793016c03
commit
50872e2bb5
@ -21,6 +21,7 @@ from app.classes.models.server_permissions import EnumPermissionsServer
|
|||||||
from app.classes.models.users import HelperUsers
|
from app.classes.models.users import HelperUsers
|
||||||
from app.classes.models.roles import HelperRoles
|
from app.classes.models.roles import HelperRoles
|
||||||
from app.classes.models.management import HelpersManagement
|
from app.classes.models.management import HelpersManagement
|
||||||
|
from app.classes.shared.tasks import TasksManager
|
||||||
from app.classes.models.servers import HelperServers
|
from app.classes.models.servers import HelperServers
|
||||||
from app.classes.shared.authentication import Authentication
|
from app.classes.shared.authentication import Authentication
|
||||||
from app.classes.shared.console import Console
|
from app.classes.shared.console import Console
|
||||||
@ -38,6 +39,7 @@ class Controller:
|
|||||||
self.users_helper: HelperUsers = HelperUsers(database, self.helper)
|
self.users_helper: HelperUsers = HelperUsers(database, self.helper)
|
||||||
self.roles_helper: HelperRoles = HelperRoles(database)
|
self.roles_helper: HelperRoles = HelperRoles(database)
|
||||||
self.servers_helper: HelperServers = HelperServers(database)
|
self.servers_helper: HelperServers = HelperServers(database)
|
||||||
|
self.tasks_manager: TasksManager = TasksManager()
|
||||||
self.management_helper: HelpersManagement = HelpersManagement(
|
self.management_helper: HelpersManagement = HelpersManagement(
|
||||||
database, self.helper
|
database, self.helper
|
||||||
)
|
)
|
||||||
@ -864,6 +866,10 @@ class Controller:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Cleanup scheduled tasks
|
# Cleanup scheduled tasks
|
||||||
|
try:
|
||||||
|
self.tasks_manager.remove_all_server_tasks(server_id)
|
||||||
|
except:
|
||||||
|
logger.info(f"Could not find active jobs for server {server_id}")
|
||||||
try:
|
try:
|
||||||
HelpersManagement.delete_scheduled_task_by_server(server_id)
|
HelpersManagement.delete_scheduled_task_by_server(server_id)
|
||||||
except DoesNotExist:
|
except DoesNotExist:
|
||||||
|
Loading…
Reference in New Issue
Block a user