This commit is contained in:
2026-07-09 23:34:34 +03:00
commit 73c4fc37f7
33 changed files with 2505 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
import asyncio
from datetime import date, timedelta
from api import api
from database import get_active_groups
async def refresh_cache():
while True:
groups = await get_active_groups()
if groups:
print(f"[CACHE] Обновляем {len(groups)} групп")
for group_id in groups:
try:
# сегодня
await api.get_schedule(
group_id,
date.today()
)
# завтра
await api.get_schedule(
group_id,
date.today() + timedelta(days=1)
)
except Exception as e:
print(
f"[CACHE] Ошибка {group_id}: {e}"
)
await asyncio.sleep(1800)