From 6ef9a981d02d545bd31534c987379534c8add999 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sat, 8 Dec 2018 09:33:03 +0100 Subject: controller: Reraise queue processing errors early --- crocoite/controller.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'crocoite/controller.py') 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 () -- cgit v1.2.3