I’m trying to understand what’s happening with the
as_completed function as I want to use it to update a progress bar after a file is scanned but it appears to “stall” after 8 coroutines are run.
completed = 0 coros = [scan_file(file_to_scan) for file_to_scan in files] print("count: ", len(coros)) for coro in asyncio.as_completed(coros): info = await coro completed += 1 print(completed)
count: 200 1 2 3 4 5 6 7 8
pauses for some time and the prints all the other numbers in a rush at the end. Is this as expected, because of the print, or for some other reason? Should I use a different function such as
wait called until pending is empty?