mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-11-17 01:04:51 +02:00
When using pool raise again exception received
This commit is contained in:
parent
e46171b826
commit
2a5cf18d20
@ -23,6 +23,7 @@ class Pool():
|
||||
"""
|
||||
Limit concurrency for running parallel tasks
|
||||
"""
|
||||
|
||||
def __init__(self, concurrency=5):
|
||||
self._tasks = []
|
||||
self._concurrency = concurrency
|
||||
@ -41,6 +42,9 @@ class Pool():
|
||||
task, args, kwargs = self._tasks.pop(0)
|
||||
pending.add(task(*args, **kwargs))
|
||||
(done, pending) = yield from asyncio.wait(pending, return_when=asyncio.FIRST_COMPLETED)
|
||||
for task in done:
|
||||
if task.exception():
|
||||
raise task.exception()
|
||||
|
||||
|
||||
def main():
|
||||
|
Loading…
Reference in New Issue
Block a user