diff --git a/main.py b/main.py index bd428c6c..55b874a8 100644 --- a/main.py +++ b/main.py @@ -2419,10 +2419,16 @@ _vital_sharing_peer_state: Dict[str, dict] = {} async def _broadcast_share_to_plugin_clients(data: dict, origin: str) -> None: - """Forward a share_* message to all opted-in plugin clients except origin.""" + """Forward a share_* message to all opted-in plugin clients except origin. + + Transient send failures are logged but do NOT evict the subscriber — + eviction only happens on actual WebSocket disconnect (handled in the + plugin receive loop's finally block). Evicting aggressively here caused + a bug where a single slow send would silently drop a subscriber and + force the user to retoggle vital sharing to get peer updates again. + """ if not _vital_sharing_subscribers: return - stale: list[str] = [] for char_name, ws in list(plugin_conns.items()): if char_name == origin: continue @@ -2432,9 +2438,6 @@ async def _broadcast_share_to_plugin_clients(data: dict, origin: str) -> None: await asyncio.wait_for(ws.send_json(data), timeout=1.0) except Exception as e: logger.debug(f"Failed forwarding share_* to {char_name}: {e}") - stale.append(char_name) - for name in stale: - _vital_sharing_subscribers.discard(name) def _update_vital_sharing_peer_state(msg_type: str, data: dict) -> None: