Add cleanup method for server stats on delete

This commit is contained in:
Andrew 2022-05-15 13:28:02 -05:00
parent 0f19c0c787
commit e161e2cf0b
2 changed files with 4 additions and 0 deletions

View File

@ -841,6 +841,7 @@ class Controller:
# Cleanup scheduled tasks
try:
srv_obj.remove_stats_job()
HelpersManagement.delete_scheduled_task_by_server(server_id)
except DoesNotExist:
logger.info("No scheduled jobs exist. Continuing.")

View File

@ -504,6 +504,9 @@ class Server:
f"Assuming it was never started."
)
def remove_stats_job(self):
self.server_scheduler.remove_job("stats_" + str(self.server_id))
def start_crash_detection(self):
# This is only used if the crash detection settings change
# while the server is running.