mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-06 07:04:12 -04:00
19 lines
537 B
Python
19 lines
537 B
Python
import asyncio
|
|
from logging import getLogger
|
|
|
|
from old.kyoo_client import KyooClient
|
|
from scanner.publisher import Publisher
|
|
|
|
|
|
logger = getLogger(__name__)
|
|
|
|
|
|
async def refresh(publisher: Publisher, client: KyooClient):
|
|
while True:
|
|
# Check for updates every 4 hours
|
|
await asyncio.sleep(60 * 60 * 4)
|
|
todo = await client.get("refreshables")
|
|
logger.info("Refreshing %d items", len(todo))
|
|
await asyncio.gather(*(publisher.refresh(**x) for x in todo))
|
|
logger.info("Refresh finish. Will check for new items to refresh in 4 hours")
|