1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

When using pool raise again exception received

This commit is contained in:
Julien Duponchelle 2016-06-10 14:41:48 +02:00
parent e46171b826
commit 2a5cf18d20
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -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():