mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-08-02 23:13:08 +02:00
fef6845c03
Long-lived TCP against the meshcore-proxy can degrade in a way the socket can't see: some commands (set_flood_scope_key with all-zero key) start timing out while RX events and other commands keep working. The 5 s execute() timeout fires with concurrent.futures.TimeoutError() — whose str() is empty — so the UI showed "Could not set region scope (none):" with no error text, and only channels with a mapped region could send because their non-zero scope_key happened to keep working. Two recovery paths: - send_channel_message now detects the timeout case (set_flood_scope_key surfaces timed_out=True) and runs force_reconnect() + one retry before failing. The user sees a brief delay instead of a cryptic error and having to restart the container. - A new _liveness_watcher_loop task runs on the DM event loop and forces a reconnect when no RX event has arrived for HEALTH_STRICT_MAX_RX_STALE_SEC (5 min). /health/strict now also reports rx_stale for TCP (previously serial/USB only), so an external watchdog could act on it too. force_reconnect() runs on the DM loop via run_coroutine_threadsafe with a 20 s cap, a 30 s cooldown to avoid churn under fire, and a _reconnect_lock to prevent concurrent attempts. mc.disconnect() fires DISCONNECTED — _intentional_disconnect tells _on_disconnected to skip its own reconnect loop so the two don't race. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>