STINNER Victor added the comment: > A timeout can be specified for the whole task using asyncio.wait_for() but > it's tricky.
Exactly, you can use wait_for() on any async operation. Why would you like to add a timeout on each async operation, while wait_for() is available? Replace event.wait(timeout=60) with wait_for(event.wait(), 60). Maybe we should put more examples using wait_for() on operations commonly used with a timeout? Guido proposed to add a timeout for some operations, but with a different meaning: maximum time without getting new events, each new event resets the timeout. It was maybe on StreamReader.readline() which uses multiple async read until it gets a full line. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21962> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com