fix(snapshot): avoid duplicate scheduled balance retry
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user