mirror of https://github.com/skygpu/skynet.git
Cancel other image task when one already finished on tg frontend ipfs image gather
parent
16df97d731
commit
cadd723191
|
@ -266,10 +266,15 @@ class SkynetTelegramFrontend:
|
||||||
logging.warning(f'couldn\'t get ipfs binary data at {link}!')
|
logging.warning(f'couldn\'t get ipfs binary data at {link}!')
|
||||||
|
|
||||||
tasks = [
|
tasks = [
|
||||||
get_and_set_results(ipfs_link),
|
asyncio.create_task(get_and_set_results(ipfs_link)),
|
||||||
get_and_set_results(ipfs_link_legacy)
|
asyncio.create_task(get_and_set_results(ipfs_link_legacy))
|
||||||
]
|
]
|
||||||
await asyncio.gather(*tasks)
|
done, pending = await asyncio.wait(
|
||||||
|
tasks, return_when=asyncio.FIRST_COMPLETED)
|
||||||
|
|
||||||
|
for task in pending:
|
||||||
|
task.cancel()
|
||||||
|
|
||||||
png_img = None
|
png_img = None
|
||||||
if ipfs_link_legacy in results:
|
if ipfs_link_legacy in results:
|
||||||
png_img = results[ipfs_link_legacy]
|
png_img = results[ipfs_link_legacy]
|
||||||
|
|
Loading…
Reference in New Issue