all repos — mycal @ eacbbc2d022f8b992d7e9f9440ec532eb033b921

private calendar anonymiser

sleep for a minute at a time

Alan Pearce
commit

eacbbc2d022f8b992d7e9f9440ec532eb033b921

parent

f8eadc5c14d493618423fe070595c131eefdce32

1 file changed, 3 insertions(+), 2 deletions(-)

changed files
M mycal.pymycal.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()