File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -53,10 +53,18 @@ def _run_initial_tasks(self):
5353 future .result ()
5454
5555 def _start_scan_tasks (self ):
56- scan_tasks = _get_scan_tasks (self ._mapping )
57-
58- for task in scan_tasks :
59- asyncio .run_coroutine_threadsafe (task (), self ._loop )
56+ async def run_tasks ():
57+ futures = [task () for task in _get_scan_tasks (self ._mapping )]
58+ for future in asyncio .as_completed (futures ):
59+ try :
60+ await future
61+ except Exception as e :
62+ # We don't exit the ioc when a scan loop errors,
63+ # but we do print the information.
64+ print (f"Scan loop stopped with exception:\n { e } " )
65+ raise e
66+
67+ asyncio .run_coroutine_threadsafe (run_tasks (), self ._loop )
6068
6169 def _run (self ):
6270 raise NotImplementedError ("Specific Backend must implement _run" )
You can’t perform that action at this time.
0 commit comments