diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2018-12-08 09:33:03 +0100 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2018-12-08 09:33:03 +0100 |
commit | 6ef9a981d02d545bd31534c987379534c8add999 (patch) | |
tree | 7e31ec880365175b9217d8fc83abebfa1cef0fdd | |
parent | 6ccd72ab96cfba36c217a77641b3b8a91906c512 (diff) | |
download | crocoite-6ef9a981d02d545bd31534c987379534c8add999.tar.gz crocoite-6ef9a981d02d545bd31534c987379534c8add999.tar.bz2 crocoite-6ef9a981d02d545bd31534c987379534c8add999.zip |
controller: Reraise queue processing errors early
-rw-r--r-- | crocoite/controller.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/crocoite/controller.py b/crocoite/controller.py index 1ee1943..f8b1420 100644 --- a/crocoite/controller.py +++ b/crocoite/controller.py @@ -171,7 +171,7 @@ class SinglePageController: while True: idleProc = asyncio.ensure_future (l.idle.wait ()) try: - finished, pending = await asyncio.wait([idleProc, timeoutProc], + finished, pending = await asyncio.wait([idleProc, timeoutProc, handle], return_when=asyncio.FIRST_COMPLETED, timeout=idleTimeout) except asyncio.CancelledError: idleProc.cancel () @@ -183,6 +183,12 @@ class SinglePageController: idleProc.cancel () timeoutProc.cancel () break + elif handle in finished: + # something went wrong while processing the data + idleProc.cancel () + timeoutProc.cancel () + handle.result () + assert False # previous line should always raise Exception elif timeoutProc in finished: # global timeout idleProc.cancel () |