Small maintenance task improvements

This commit is contained in:
DevilXD committed 2022-07-23 12:59:36 +02:00
1 parent 8cf9b8f6f8
commit 7817190dc2
1 file changed
+3 -3
+3 -3
View File
@@ -460,8 +460,8 @@ class Twitch:
@task_wrapper
async def _maintenance_task(self) -> None:
# NOTE: this task is started anew / restarted on every inventory fetch
# 1m sleep to let the application sort out the starting sequence and watching channel
await asyncio.sleep(60)
# short sleep to let the application sort out the starting sequence and watching channel
await asyncio.sleep(30)
# figure out the maximum sleep period
# 1h at max, but can be shorter if there's an upcoming campaign earlier than that
# divide the period into up to two evenly spaced checks (usually ~15-30m)
@@ -473,7 +473,7 @@ class Twitch:
)
if period > one_hour:
period = one_hour
times = ceil(period.total_seconds() / (30 * 60))
times = ceil(period / timedelta(minutes=30))
period /= times
for i in range(times):
channel = self.watching_channel.get_with_default(None)