Wrap asyncio.wait into a saner alternative that raises TimeoutError.
Fixes #494
This commit is contained in:
@ -276,3 +276,10 @@ def async_all(gen):
|
||||
if not elem:
|
||||
return False
|
||||
return True
|
||||
|
||||
@asyncio.coroutine
|
||||
def sane_wait_for(futures, *, timeout, loop):
|
||||
done, pending = yield from asyncio.wait(futures, timeout=timeout, loop=loop)
|
||||
|
||||
if len(pending) != 0:
|
||||
raise asyncio.TimeoutError()
|
||||
|
Reference in New Issue
Block a user