sleep for a minute at a time
1 file changed, 3 insertions(+), 2 deletions(-)
changed files
M mycal.py → mycal.py
@@ -224,14 +224,15 @@ now = datetime.now(tz) tomorrow = datetime.combine(now.date() + timedelta(days=1), time.min, tzinfo=tz) return int((tomorrow - now).total_seconds()) +TICK = 60 async def periodic_calendar_update(): """ Background task to periodically update the calendar cache """ global next_update_seconds while True: - await asyncio.sleep(1) - next_update_seconds -= 1 + await asyncio.sleep(TICK) + next_update_seconds -= TICK if next_update_seconds <= 0: await update_calendar_cache() schedule_next_update()