mirror of
https://github.com/doms9/iptv.git
synced 2026-01-21 03:59:03 +01:00
e
fix hanging if no available mirrors
This commit is contained in:
parent
3a1d2742f1
commit
00000d9233
8 changed files with 24 additions and 16 deletions
|
|
@ -59,7 +59,8 @@ async def get_api_data(client: httpx.AsyncClient, url: str) -> list[dict[str, An
|
|||
|
||||
|
||||
async def refresh_api_cache(
|
||||
client: httpx.AsyncClient, ts: float
|
||||
client: httpx.AsyncClient,
|
||||
now_ts: float,
|
||||
) -> list[dict[str, Any]]:
|
||||
log.info("Refreshing API cache")
|
||||
|
||||
|
|
@ -70,12 +71,13 @@ async def refresh_api_cache(
|
|||
|
||||
results = await asyncio.gather(*tasks)
|
||||
|
||||
data = list(chain(*results))
|
||||
if not (data := list(chain(*results))):
|
||||
return []
|
||||
|
||||
for ev in data:
|
||||
ev["ts"] = ev.pop("timestamp")
|
||||
|
||||
data[-1]["timestamp"] = ts
|
||||
data[-1]["timestamp"] = now_ts
|
||||
|
||||
return data
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue