fix: suppress redundant console port setter log during Docker node create

create_docker_node() passes console, aux etc. to create_node() via
.get() so those keys remain in node_data.  The setattr fallback loop
then re-applies them — if reserve_tcp_port returned a different port
in __init__, the setter fires an INFO log and performs a wasted
release→reserve round-trip.

Pop the 15 keys already consumed by create_node() before the loop so
it only handles truly extra keys.
This commit is contained in:
YueGuobin 2026-08-12 00:10:01 +08:00
parent f69098f441
commit 72917596ab
No known key found for this signature in database

View File

@ -81,6 +81,15 @@ async def create_docker_node(project_id: UUID, node_data: schemas.DockerCreate)
memory=node_data.get("memory", 0),
cpus=node_data.get("cpus", 0),
)
# Pop keys already consumed by create_node above so the setattr
# fallback loop below only applies truly extra keys and does not
# re-trigger console/aux port setter logging.
for key in (
"console", "console_type", "console_resolution", "console_http_port",
"console_http_path", "aux", "aux_type", "start_command", "environment",
"adapters", "mac_address", "extra_hosts", "extra_volumes", "memory", "cpus",
):
node_data.pop(key, None)
for name, value in node_data.items():
if name != "node_id":
if hasattr(container, name) and getattr(container, name) != value: