1
0
mirror of https://github.com/0O0o0oOoO00/Alas.git synced 2026-05-14 11:19:26 +08:00

add: check alas config if it is existing when check instance

This commit is contained in:
0O0o0oOoO00
2025-10-11 18:48:31 +08:00
parent f9dffbaaa1
commit 814eca6f2a

View File

@@ -45,7 +45,11 @@ class InstanceWatcher:
def check_instances(self):
ins_has_triggered = []
ins_inexists = []
for name, setting in self.instances.items():
if not has_config_mod(name):
ins_inexists.append(name)
continue
ins = ProcessManager.get_manager(name)
if not ins.alive:
if ins.state != 3:
@@ -65,6 +69,8 @@ class InstanceWatcher:
title=f"Alas <{ins.config_name}> instance restarted too many times",
content=f"Too many critical error occurred, instance restarted too many times",
)
for i in ins_inexists:
self.remove_instance(i)
for i in ins_has_triggered:
self.remove_instance(i)
@@ -108,6 +114,7 @@ class InstanceWatcher:
def check_instance_status(self):
for config_name in self.get_all_prev_instance():
if not has_config_mod(config_name):
self.remove_status_file(config_name)
continue
ins = ProcessManager.get_manager(config_name)
if ins.alive: