Timeout context manager#611
Timeout context manager#611asvetlov merged 12 commits intoaio-libs:masterfrom jettify:timeout-context-manager
Conversation
|
interesting idea, I see this more in asyncio itself than aiohttp. |
|
Nice!
However, I have bad feelings that this context manager wouldn't work correctly for the tasks that are spawned from the timeout block: I was expected to see an exception, or |
|
Looks like we should make the same guarantees for |
|
I ported tests from async with Timeout(None):
t = await futurein this case timeout is not calculated, similar to |
|
as result of discussion in IRL:
|
aiohttp/helpers.py
Outdated
There was a problem hiding this comment.
raise_error should be True by default (asyncio.wait_for() raises exception on timeout).
After thinking I doubt do we need the parameter at all.
|
raise_error argument removed |
@asvetlov I implemented your idea about timeout context manager.
Open questions:
with Timeout(1):insteadasync with Timeout(1)?:Edit: Add related stackoverflow question:
http://stackoverflow.com/questions/33217429/creating-a-temporary-async-timer-callback-to-a-bound-method-with-python-asyncio