Opt: Delay weekly to next monday to save time

optimised for running once a day
This commit is contained in:
LmeSzinc 2024-06-15 00:06:17 +08:00
parent 3a22813ad5
commit ecc633df89
3 changed files with 7 additions and 4 deletions

View File

@ -298,6 +298,7 @@ class AzurLaneConfig(ConfigUpdater, ManualConfig, GeneratedConfig, ConfigWatcher
deep_set(self.data, keys=f"{task}.Scheduler.NextRun", value=now) deep_set(self.data, keys=f"{task}.Scheduler.NextRun", value=now)
limit_next_run(['BattlePass'], limit=now + timedelta(days=40, seconds=-1)) limit_next_run(['BattlePass'], limit=now + timedelta(days=40, seconds=-1))
limit_next_run(['Weekly'], limit=now + timedelta(days=7, seconds=-1))
limit_next_run(self.args.keys(), limit=now + timedelta(hours=24, seconds=-1)) limit_next_run(self.args.keys(), limit=now + timedelta(hours=24, seconds=-1))
def override(self, **kwargs): def override(self, **kwargs):

View File

@ -10,9 +10,9 @@ class ManualConfig:
SCHEDULER_PRIORITY = """ SCHEDULER_PRIORITY = """
Restart Restart
> BattlePass > DailyQuest > Assignment > Weekly > Dungeon > Assignment
> DailyQuest > BattlePass
> Freebies > DataUpdate > Freebies > DataUpdate
> Weekly > Dungeon
> Rogue > Rogue
""" """

View File

@ -1,3 +1,4 @@
from module.config.utils import get_server_next_monday_update
from module.logger import logger from module.logger import logger
from module.ocr.ocr import DigitCounter from module.ocr.ocr import DigitCounter
from tasks.daily.keywords import KEYWORDS_DAILY_QUEST from tasks.daily.keywords import KEYWORDS_DAILY_QUEST
@ -62,6 +63,7 @@ class WeeklyDungeon(Dungeon):
DUNGEON_LIST.search_button = OCR_DUNGEON_LIST DUNGEON_LIST.search_button = OCR_DUNGEON_LIST
self._dungeon_nav_goto(KEYWORDS_DUNGEON_NAV.Echo_of_War) self._dungeon_nav_goto(KEYWORDS_DUNGEON_NAV.Echo_of_War)
self._dungeon_wait_until_dungeon_list_loaded() self._dungeon_wait_until_dungeon_list_loaded()
monday = get_server_next_monday_update(self.config.Scheduler_ServerUpdate)
# Check limit # Check limit
remain = self.get_weekly_remain() remain = self.get_weekly_remain()
@ -71,7 +73,7 @@ class WeeklyDungeon(Dungeon):
remain = 1 remain = 1
else: else:
logger.info('Reached the limit to get Echo_of_War rewards, stop') logger.info('Reached the limit to get Echo_of_War rewards, stop')
self.config.task_delay(server_update=True) self.config.task_delay(target=monday)
self.config.task_stop() self.config.task_stop()
self._dungeon_insight(dungeon) self._dungeon_insight(dungeon)
@ -98,7 +100,7 @@ class WeeklyDungeon(Dungeon):
# Finished all remains # Finished all remains
if count >= remain: if count >= remain:
logger.info('All Echo_of_War rewards got') logger.info('All Echo_of_War rewards got')
self.config.task_delay(server_update=True) self.config.task_delay(target=monday)
self.config.task_stop() self.config.task_stop()
logger.warning(f'Unexpected Echo_of_War case, count={count}, remain={remain}') logger.warning(f'Unexpected Echo_of_War case, count={count}, remain={remain}')