mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-08-27 12:30:13 +03:00
Optimize project variable updates to use parallel node processing
Performance improvement for project variable updates when multiple containers are present. Previously, nodes were updated serially in a for loop, causing: - 5 containers: ~35 seconds (7s per container) - 10 containers: ~70 seconds - 20 containers: ~140 seconds (2min 20sec) Changed to parallel processing using asyncio.gather(), reducing total time to the duration of the slowest single node update (~7 seconds regardless of container count). The change maintains error handling with return_exceptions=True to ensure one node's update failure doesn't prevent others from completing. This is particularly important for users with large topologies containing many Docker containers that need to be recreated when project variables change. Related to issue #2755 ghost node timeout fix.
This commit is contained in:
parent
8c1dbdf079
commit
598029face
@ -293,9 +293,14 @@ class Project:
|
||||
|
||||
# we need to update docker nodes when variables changes
|
||||
if original_variables != variables:
|
||||
# Parallelize node updates for better performance
|
||||
tasks = []
|
||||
for node in self.nodes:
|
||||
if hasattr(node, "update"):
|
||||
await node.update()
|
||||
tasks.append(node.update())
|
||||
|
||||
if tasks:
|
||||
await asyncio.gather(*tasks, return_exceptions=True)
|
||||
|
||||
async def close(self):
|
||||
"""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user