fix(snapshot): avoid duplicate scheduled balance retry

This commit is contained in:
Hermes Agent
2026-09-13 15:49:06 +09:00
parent 8b3e7ac753
commit 635a9a9f9f
2 changed files with 47 additions and 6 deletions
+7 -6
View File
@@ -117,15 +117,16 @@ class SnapshotScheduler:
_log.exception("snapshot scheduler tick failed")
def _maybe_tick(self) -> None:
self._maybe_retry_balance_workers()
now_kst = self._clock().astimezone(_KST)
target = datetime.combine(now_kst.date(), self._schedule_kst, tzinfo=_KST)
if now_kst < target:
return
last = self._last_fired_date
if last is not None and last.date() == now_kst.date():
return # already fired today
self.run_once()
daily_due = now_kst >= target and (last is None or last.date() != now_kst.date())
if daily_due:
# The daily pass already invokes every eligible balance worker.
# Do not run a due retry first and duplicate the same broker read.
self.run_once()
return
self._maybe_retry_balance_workers()
# ---- entry-allowed gate (REQ-114) ------------------------------------
def get_entry_allowed(self) -> bool: