Skip to content

Commit 580e7b2

Browse files
committed
wait on_progress
1 parent e421141 commit 580e7b2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

snapsave/snapsave.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from __future__ import annotations
2-
from asyncio.tasks import ensure_future
2+
from asyncio.tasks import ensure_future, gather
33
from io import BufferedWriter, BytesIO
44
from ast import literal_eval
55
from typing import Any, Literal, Optional, Union
@@ -147,6 +147,7 @@ async def download(
147147
await out.on_open(self, request)
148148
async for i in request.aiter_bytes(chunk_size):
149149
tasks.append(ensure_future(out.on_progress(i)))
150+
await gather(*tasks)
150151
await out.on_finish(self, request)
151152
else:
152153
async for i in request.aiter_bytes(chunk_size):

0 commit comments

Comments
 (0)