Skip to content

Commit

Permalink
Wrap coroutine objects in a task prior to calling wait.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wes Payne authored and terrycain committed Mar 12, 2022
1 parent cc7891a commit 3861949
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion aioboto3/s3/inject.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,10 @@ async def file_reader() -> None:
# So by this point all of the file is read and in a queue

# wait for either io queue is finished, or an exception has been raised
_, pending = await asyncio.wait({io_queue.join(), exception_event.wait()}, return_when=asyncio.FIRST_COMPLETED)
_, pending = await asyncio.wait(
{asyncio.create_task(io_queue.join()), asyncio.create_task(exception_event.wait())},
return_when=asyncio.FIRST_COMPLETED
)

if exception_event.is_set() or len(finished_parts) != expected_parts:
# An exception during upload or for some reason the finished parts dont match the expected parts, cancel upload
Expand Down

0 comments on commit 3861949

Please sign in to comment.