Fix bug where stopping a server without crash detection would crash crafty...ironic, I know.

This commit is contained in:
Andrew 2022-01-30 15:28:48 -05:00
parent 7aebd8bd5b
commit e69a3be381

View File

@ -322,9 +322,10 @@ class Server:
def stop_server(self): def stop_server(self):
if self.settings['stop_command']: if self.settings['stop_command']:
self.send_command(self.settings['stop_command']) self.send_command(self.settings['stop_command'])
#remove crash detection watcher if self.settings['crash_detection']:
logger.info(f"Removing crash watcher for server {self.name}") #remove crash detection watcher
self.server_scheduler.remove_job('c_' + str(self.server_id)) logger.info(f"Removing crash watcher for server {self.name}")
self.server_scheduler.remove_job('c_' + str(self.server_id))
else: else:
#windows will need to be handled separately for Ctrl+C #windows will need to be handled separately for Ctrl+C
self.process.terminate() self.process.terminate()
@ -408,7 +409,7 @@ class Server:
print("crash detected") print("crash detected")
# clear the old scheduled watcher task # clear the old scheduled watcher task
self.server_scheduler.remove_job("c_"+str(self.server_id)) self.server_scheduler.remove_job(f"c_{self.server_id}")
# the server crashed, or isn't found - so let's reset things. # the server crashed, or isn't found - so let's reset things.
logger.warning(f"The server {name} seems to have vanished unexpectedly, did it crash?") logger.warning(f"The server {name} seems to have vanished unexpectedly, did it crash?")