From 4f214ee7a263b8e28f1ba1e65f78bf5b3a0c8d1c Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Mon, 17 Jun 2024 02:29:39 +0800 Subject: [PATCH 1/2] Fix: CloudRemain was never wrote into config --- tasks/login/cloud.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tasks/login/cloud.py b/tasks/login/cloud.py index 42b707eb1..36e72b3b6 100644 --- a/tasks/login/cloud.py +++ b/tasks/login/cloud.py @@ -158,9 +158,9 @@ class LoginAndroidCloud(ModuleBase): logger.info(f'Cloud remain: season pass {season_pass} days, {paid} min paid, {free} min free') with self.config.multi_set(): - self.config.stored.CloudRemainSeasonPass = season_pass - self.config.stored.CloudRemainPaid = paid - self.config.stored.CloudRemainFree = free + self.config.stored.CloudRemainSeasonPass.value = season_pass + self.config.stored.CloudRemainPaid.value = paid + self.config.stored.CloudRemainFree.value = free def _cloud_enter(self, skip_first=False): """ From 048abcfde44cf0a4f7ce26cbc16f57cbffc146fb Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Mon, 17 Jun 2024 02:34:37 +0800 Subject: [PATCH 2/2] Fix: Too many config read/write in Stored.clear() --- module/config/config.py | 13 +++++++------ module/config/stored/classes.py | 28 +++++++++++++++------------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/module/config/config.py b/module/config/config.py index 516498281..61d8cb5d7 100644 --- a/module/config/config.py +++ b/module/config/config.py @@ -510,12 +510,13 @@ class AzurLaneConfig(ConfigUpdater, ManualConfig, GeneratedConfig, ConfigWatcher Raises: TaskEnd: Call task `DailyQuest` and stop current task """ - if self.stored.DailyActivity.is_expired(): - logger.info('DailyActivity expired') - self.stored.DailyActivity.clear() - if self.stored.DailyQuest.is_expired(): - logger.info('DailyQuest expired') - self.stored.DailyQuest.clear() + with self.multi_set(): + if self.stored.DailyActivity.is_expired(): + logger.info('DailyActivity expired') + self.stored.DailyActivity.clear() + if self.stored.DailyQuest.is_expired(): + logger.info('DailyQuest expired') + self.stored.DailyQuest.clear() def update_battle_pass_quests(self): """ diff --git a/module/config/stored/classes.py b/module/config/stored/classes.py index 015d9c7f1..ae0af52e7 100644 --- a/module/config/stored/classes.py +++ b/module/config/stored/classes.py @@ -290,12 +290,13 @@ class StoredDaily(StoredCounter, StoredExpiredAt0400): self.quest6 = '' def clear(self): - self.quest1 = '' - self.quest2 = '' - self.quest3 = '' - self.quest4 = '' - self.quest5 = '' - self.quest6 = '' + with self._config.multi_set(): + self.quest1 = '' + self.quest2 = '' + self.quest3 = '' + self.quest4 = '' + self.quest5 = '' + self.quest6 = '' class StoredDungeonDouble(StoredExpiredAt0400): @@ -380,13 +381,14 @@ class StoredBattlePassWeeklyQuest(StoredCounter, StoredExpiredAtMonday0400): self.quest7 = '' def clear(self): - self.quest1 = '' - self.quest2 = '' - self.quest3 = '' - self.quest4 = '' - self.quest5 = '' - self.quest6 = '' - self.quest7 = '' + with self._config.multi_set(): + self.quest1 = '' + self.quest2 = '' + self.quest3 = '' + self.quest4 = '' + self.quest5 = '' + self.quest6 = '' + self.quest7 = '' class StoredBattlePassSimulatedUniverse(StoredCounter):