Wrap asyncio.wait into a saner alternative that raises TimeoutError.

Fixes #494
This commit is contained in:
Rapptz committed 2017-02-25 00:03:43 -05:00
1 parent b2ffeac297
commit 29f676c42e
2 files changed
+10 -3

No files matched your search

+7
View File
@@ -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()