asyncio.gather -> asyncio.wait (with timeout)

This commit is contained in:
jesopo 2019-07-08 14:50:11 +01:00
parent 469c725675
commit c19c6c0e14

View file

@ -131,7 +131,7 @@ def request_many(urls: typing.List[str]) -> typing.Dict[str, Response]:
awaits = []
for url in urls:
awaits.append(_request(url))
task = asyncio.gather(*awaits, return_exceptions=True, loop=loop)
task = asyncio.wait(awaits, loop=loop, timeout=5)
loop.run_until_complete(task)
loop.close()