cache complete result
This commit is contained in:
parent
cd3bd950ae
commit
a605e7c43d
@ -193,6 +193,10 @@ async def get_meta(upstream, proxy, logger):
|
|||||||
return await get_from_runner((2, upstream), MetaRunner(upstream, proxy, logger), logger)
|
return await get_from_runner((2, upstream), MetaRunner(upstream, proxy, logger), logger)
|
||||||
|
|
||||||
async def get_any(upstream, proxy, logger):
|
async def get_any(upstream, proxy, logger):
|
||||||
|
cache_key = (3, upstream)
|
||||||
|
cached = upstream_cache.get(cache_key)
|
||||||
|
if isinstance(cached, StreamData):
|
||||||
|
return cached
|
||||||
tasks = []
|
tasks = []
|
||||||
tasks.append(asyncio.create_task(get_streamlink(upstream, proxy, logger)))
|
tasks.append(asyncio.create_task(get_streamlink(upstream, proxy, logger)))
|
||||||
tasks.append(asyncio.create_task(get_ytdl(upstream, proxy, logger)))
|
tasks.append(asyncio.create_task(get_ytdl(upstream, proxy, logger)))
|
||||||
@ -206,6 +210,7 @@ async def get_any(upstream, proxy, logger):
|
|||||||
result.update("title", temp_result.title(), temp_result.override)
|
result.update("title", temp_result.title(), temp_result.override)
|
||||||
result.update("description", temp_result.description(), temp_result.override)
|
result.update("description", temp_result.description(), temp_result.override)
|
||||||
if result.complete():
|
if result.complete():
|
||||||
|
upstream_cache[cache_key] = result
|
||||||
break
|
break
|
||||||
for task in tasks:
|
for task in tasks:
|
||||||
if not task.done():
|
if not task.done():
|
||||||
|
Loading…
Reference in New Issue
Block a user