1
0
mirror of https://github.com/0O0o0oOoO00/Alas.git synced 2026-05-14 12:59:25 +08:00

fix: only remove instance status cache file when stopped manually

This commit is contained in:
0O0o0oOoO00
2025-10-16 23:41:22 +08:00
parent 43c0874349
commit e952ee22a5
3 changed files with 8 additions and 6 deletions

View File

@@ -97,7 +97,7 @@ class InstanceWatcher:
f = pathlib.Path(InstanceWatcher.STATUS_DIR) / f"{name}.status"
return f.exists()
def try_add_instance(self, name):
def try_add_instance(self, name, add_status_cache_file=True):
if name in self.instances:
return
config = AzurLaneConfig(name)
@@ -109,7 +109,8 @@ class InstanceWatcher:
notify_config=full_config.Alas_Error_OnePushConfig
)
self.instances[name] = setting
self.add_status_file(name)
if add_status_cache_file:
self.add_status_file(name)
def check_instance_status(self):
for config_name in self.get_all_prev_instance():
@@ -122,10 +123,11 @@ class InstanceWatcher:
if ins.detailed_instance_status == ProcessManager.DetailInstanceStatus.NoRenderables:
ins.start("alas")
def remove_instance(self, name):
def remove_instance(self, name, remove_status_cache_file=True):
try:
self.instances.pop(name)
self.remove_status_file(name)
if remove_status_cache_file:
self.remove_status_file(name)
except Exception:
...