link watcher switch to event based instead of polling
All checks were successful
Build and Deploy MITM Webserver / traffic_target (push) Successful in 1s
Build and Deploy MITM Webserver / build (push) Successful in 9s

This commit is contained in:
2026-03-09 15:49:13 +01:00
parent c57d6ecc67
commit 665c0b4475
5 changed files with 118 additions and 54 deletions

View File

@@ -86,10 +86,10 @@ class BridgeRemoveRequest(BaseModel):
class BridgeLinkStateEnableRequest(BaseModel):
"""Payload for enabling bridge member link-state propagation."""
poll_interval_seconds: float = Field(
settings.bridge_link_state_poll_interval_seconds,
recovery_holdoff_seconds: float = Field(
settings.bridge_link_state_recovery_holdoff_seconds,
gt=0,
description="Polling interval for member link-state checks.",
description="Holdoff before sibling interfaces are restored after recovery.",
)
@@ -109,11 +109,12 @@ class BridgeLinkStateWatcherStatus(BaseModel):
bridge: str = Field(..., description="Bridge interface name.")
active: bool = Field(..., description="Whether the watcher thread is currently active.")
poll_interval_seconds: Optional[float] = Field(None, description="Watcher polling interval.")
last_poll_ts: Optional[float] = Field(None, description="Unix timestamp of the last poll.")
event_driven: Optional[bool] = Field(None, description="Whether the watcher is driven by netlink link events.")
last_event_ts: Optional[float] = Field(None, description="Unix timestamp of the last processed event/state evaluation.")
last_error: Optional[str] = Field(None, description="Most recent watcher error, if any.")
last_action: Optional[str] = Field(None, description="Most recent propagation action.")
suppressed_members: List[str] = Field(default_factory=list, description="Members currently forced down by the watcher.")
recovery_holdoff_seconds: Optional[float] = Field(None, description="Configured recovery holdoff before restoring siblings.")
members: Dict[str, BridgeMemberLinkStateInfo] = Field(default_factory=dict, description="Per-member link-state snapshot.")
message: Optional[str] = Field(None, description="Optional informational message.")
@@ -437,7 +438,7 @@ def enable_bridge_link_state_watcher(
status = bridge_link_state_manager.enable(
bridge_name=bridge_name,
poll_interval_seconds=req.poll_interval_seconds,
recovery_holdoff_seconds=req.recovery_holdoff_seconds,
)
return _watcher_status_response(status)