fix(marker): restore markers from topology on project load

_create_link_from_topology_data now restores traffic-insight markers
(mirroring how filters are restored via update_filters), so markers —
including their color — survive project close/reopen and server restart.

Guard start_marker's uBridge POST with 'if self._created' (exactly as
update_filters guards its update() call): during project load the link
is not yet created, so only _markers state is recorded and the marker
is applied once via the NIO flow in create()/_ubridge_apply_markers —
no double application.
This commit is contained in:
YueGuobin committed 2026-07-16 00:39:51 +08:00
1 parent 3f15ac38f6
commit 88c03d1431
2 files changed
+30 -7

No files matched your search

+16
View File
@@ -765,6 +765,22 @@ class Project:
"Dropping invalid filters on link %s: %s",
link_data.get("link_id"), e
)
# Restore traffic-insight markers. Each marker's capture side is resolved
# when the link is (re)created and the marker is applied to uBridge via
# _ubridge_apply_markers in add_ubridge_udp_connection.
for name, marker in (link_data.get("markers") or {}).items():
try:
await link.start_marker(
name=name,
bpf=marker["bpf"],
tag=marker.get("tag"),
color=marker.get("color"),
)
except (ControllerError, KeyError) as e:
log.warning(
"Dropping marker %s on link %s: %s",
name, link_data.get("link_id"), e
)
if "link_style" in link_data:
await link.update_link_style(link_data["link_style"])
if "show_filters_icon" in link_data: