Stop the maintenance task from executing triggers...;

if we're reloading the whole inventory anyway
This commit is contained in:
DevilXD committed 2022-11-24 13:23:32 +01:00
1 parent 01055b4516
commit 4b30cf116b
1 file changed
+5
+5
View File
@@ -973,6 +973,7 @@ class Twitch:
now = datetime.now(timezone.utc) now = datetime.now(timezone.utc)
next_period = now + max_period next_period = now + max_period
while True: while True:
# exit if there's no need to repeat the loop
now = datetime.now(timezone.utc) now = datetime.now(timezone.utc)
if now >= next_period: if now >= next_period:
break break
@@ -983,6 +984,10 @@ class Twitch:
self._mnt_triggers.popleft() self._mnt_triggers.popleft()
next_trigger = switch_trigger next_trigger = switch_trigger
await asyncio.sleep((next_trigger - now).total_seconds()) await asyncio.sleep((next_trigger - now).total_seconds())
# exit after waiting, before the actions
now = datetime.now(timezone.utc)
if now >= next_period:
break
if trigger_switch: if trigger_switch:
self.change_state(State.CHANNEL_SWITCH) self.change_state(State.CHANNEL_SWITCH)
# ensure that we don't have unclaimed points bonus # ensure that we don't have unclaimed points bonus