Fix cancelation

This commit is contained in:
2022-04-26 10:33:25 +03:00
parent f8a9bbadf8
commit 4a80243d6b

View File

@@ -105,7 +105,13 @@ class FLDownloader(BaseDownloader):
await data[0].aclose() await data[0].aclose()
await data[1].aclose() await data[1].aclose()
except (NotSuccess, ReceivedHTML, ConvertationError, FileNotFoundError): except (
NotSuccess,
ReceivedHTML,
ConvertationError,
FileNotFoundError,
ValueError,
):
continue continue
async def _wait_until_some_done( async def _wait_until_some_done(
@@ -122,8 +128,9 @@ class FLDownloader(BaseDownloader):
try: try:
data = task.result() data = task.result()
for p_task in pending: await self._close_other_done(
p_task.cancel() {ttask for ttask in pending if not ttask.cancel()}
)
await self._close_other_done( await self._close_other_done(
{ttask for ttask in done if ttask != task} {ttask for ttask in done if ttask != task}