diff --git a/module/instance_watcher.py b/module/instance_watcher.py index 79227eb3d..7d82b4156 100644 --- a/module/instance_watcher.py +++ b/module/instance_watcher.py @@ -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: ... diff --git a/module/webui/app.py b/module/webui/app.py index ab983340e..501f9aa8a 100644 --- a/module/webui/app.py +++ b/module/webui/app.py @@ -1632,7 +1632,7 @@ class AlasGUI(AlasGUI): switch_scheduler = BinarySwitchButton( label_on=t("Gui.Button.Stop"), label_off=t("Gui.Button.Start"), - onclick_on=lambda: self.alas.stop(), + onclick_on=lambda: self.alas.stop(remove_status_cache_file=True), onclick_off=lambda: self.alas.start(None, updater.event), get_state=lambda: self.alas.alive, color_on="off", diff --git a/module/webui/process_manager.py b/module/webui/process_manager.py index c9d1d86db..09127ee98 100644 --- a/module/webui/process_manager.py +++ b/module/webui/process_manager.py @@ -250,7 +250,7 @@ class ProcessManager(ProcessManager): InstanceWatcher.get_instance().try_add_instance(self.config_name) def stop(self, *args, **kwargs): - InstanceWatcher.get_instance().remove_instance(self.config_name) + InstanceWatcher.get_instance().remove_instance(self.config_name, remove_status_cache_file=kwargs.get("remove_status_cache_file", False)) super().stop(*args, **kwargs) @property