From 22adbb92b8f33bbcff1a6c5dce30c4b155bdb73f Mon Sep 17 00:00:00 2001 From: 0O0o0oOoO00 <11174151+0O0o0oOoO00@users.noreply.github.com> Date: Fri, 10 Oct 2025 18:33:06 +0800 Subject: [PATCH] add: delay force enabled task which has cased many errors --- alas.py | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/alas.py b/alas.py index b6b9f2ef5..81eda6c77 100644 --- a/alas.py +++ b/alas.py @@ -963,6 +963,9 @@ class AzurLaneAutoScript(AzurLaneAutoScript): except KeyError: return task + def is_force_enabled_task(self, task): + return task in ["Research", "Reward", "Commission"] + def loop(self): if self.is_azur: CrackResource(self.config, self.device).ensure() @@ -1035,16 +1038,28 @@ class AzurLaneAutoScript(AzurLaneAutoScript): if self.is_enabled_disable_task: if not self.repeated_failed_task_counter.count_once(): - msg = "This task has caused many errors already, disable it" - logger.warning(msg) - self.config.disable_task(task) - self.failed_task_counter.reset_task(task) - self.repeated_failed_task_counter.reset() - handle_notify( - self.config.Error_OnePushConfig, - title=f"Alas <{self.config_name}> disabled `{self.get_task_name(task)}`", - content=msg, - ) + if not self.is_force_enabled_task(task): + msg = "This task has caused many errors already, disable it" + logger.warning(msg) + self.config.disable_task(task) + self.failed_task_counter.reset_task(task) + self.repeated_failed_task_counter.reset() + handle_notify( + self.config.Error_OnePushConfig, + title=f"Alas <{self.config_name}> disabled `{self.get_task_name(task)}`", + content=msg, + ) + else: + msg = "This task has caused many errors already, but it is force enabled, delay it" + logger.warning(msg) + self.config.task_delay(target=datetime.now() + timedelta(hours=6), task=task) + self.failed_task_counter.reset_task(task) + self.repeated_failed_task_counter.reset() + handle_notify( + self.config.Error_OnePushConfig, + title=f"Alas <{self.config_name}> delay `{self.get_task_name(task)}`", + content=msg, + ) else: exit(1)