Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: more strict failure check for restart sensitive tasks #4024

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions alas.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
from module.logger import logger
from module.notify import handle_notify

RESTART_SENSITIVE_TASKS = ['OpsiObscure', 'OpsiAbyssal', 'OpsiCrossMonth']


class AzurLaneAutoScript:
stop_event: threading.Event = None
Expand Down Expand Up @@ -542,8 +544,8 @@ def loop(self):
failed = deep_get(self.failure_record, keys=task, default=0)
failed = 0 if success else failed + 1
deep_set(self.failure_record, keys=task, value=failed)
if failed >= 3:
logger.critical(f"Task `{task}` failed 3 or more times.")
if failed >= 3 or failed >= 1 and task in RESTART_SENSITIVE_TASKS:
logger.critical(f"Task `{task}` failed {failed} or more times.")
logger.critical("Possible reason #1: You haven't used it correctly. "
"Please read the help text of the options.")
logger.critical("Possible reason #2: There is a problem with this task. "
Expand All @@ -552,7 +554,7 @@ def loop(self):
handle_notify(
self.config.Error_OnePushConfig,
title=f"Alas <{self.config_name}> crashed",
content=f"<{self.config_name}> RequestHumanTakeover\nTask `{task}` failed 3 or more times.",
content=f"<{self.config_name}> RequestHumanTakeover\nTask `{task}` failed {failed} or more times.",
)
exit(1)

Expand Down