mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-09-05 01:25:15 +03:00
Fix unnecessary Docker container recreation when renaming a project
When renaming a project that has running Docker containers, the containers were unnecessarily stopped, removed, and recreated, even though the project name change doesn't affect container configuration. Root cause: - Client sends complete project object including variables: [] during rename - Controller unconditionally notified all computes about the update - Docker nodes rebuild containers on any project update notification Solution: - Only notify compute nodes when variables field has actual content - Treat None and [] as semantically equivalent (no variables) - Empty variables don't affect running containers, so no need to update Impact: - Project rename operations no longer trigger ~7 second container rebuilds - Only actual variable changes trigger container recreation - Fixes issue #2760
This commit is contained in:
parent
06b02981df
commit
0ba180ad1d
@ -197,9 +197,11 @@ class Project:
|
||||
self.emit_controller_notification("project.updated", self.asdict())
|
||||
self.dump()
|
||||
|
||||
# update on computes
|
||||
for compute in list(self._project_created_on_compute):
|
||||
await compute.put(f"/projects/{self._id}", {"variables": self.variables})
|
||||
# Only notify computes if variables actually changed and have content
|
||||
# None and empty list are semantically equivalent (no variables) and don't affect running nodes
|
||||
if "variables" in kwargs and kwargs["variables"]:
|
||||
for compute in list(self._project_created_on_compute):
|
||||
await compute.put(f"/projects/{self._id}", {"variables": self.variables})
|
||||
|
||||
def reset(self):
|
||||
"""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user