Skip to content

Commit

Permalink
Await gather
Browse files Browse the repository at this point in the history
  • Loading branch information
multimeric committed Jun 26, 2024
1 parent f6900e0 commit 169bfc9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions filesender/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ async def upload_file(self, file_info: response.File, path: Path) -> None:
self._upload_chunk(chunk=chunk, offset=offset, file_info=file_info)
)
# Pause until all running tasks are finished
gather(*tasks)
await gather(*tasks)

async def _upload_chunk(
self,
Expand Down Expand Up @@ -294,7 +294,7 @@ async def download_files(
self.download_file(token=token, file_id=file, out_dir=out_dir)
for file in await self._files_from_token(token)
]
gather(*tasks)
await gather(*tasks)

async def download_file(
self,
Expand Down Expand Up @@ -369,7 +369,7 @@ async def upload_workflow(
# Upload each file in parallel
# Note: update to TaskGroup once Python 3.10 is unsupported
tasks = [self.upload_complete(file_info=file, path=files_by_name[file["name"]]) for file in transfer["files"]]
gather(*tasks)
await gather(*tasks)

transfer = await self.update_transfer(
transfer_id=transfer["id"], body={"complete": True}
Expand Down

0 comments on commit 169bfc9

Please sign in to comment.