diff --git a/client/lib/state/connection_provider.dart b/client/lib/state/connection_provider.dart index da31aa8..9b758e8 100644 --- a/client/lib/state/connection_provider.dart +++ b/client/lib/state/connection_provider.dart @@ -87,6 +87,7 @@ class ConnectionController extends StateNotifier { Timer? _elapsed; Timer? _watchdog; bool _probing = false; + int _statsTick = 0; // 仅诊断:_onStats 限频打日志 // 本次 off 的提示语(节点异常/自动切换);kernel off 与显式断开都读它,避免被互相覆盖。 // 仅 _connect 开始时清空。用户主动断开则保持 null(无提示)。 String? _offNotice; @@ -232,8 +233,16 @@ class ConnectionController extends StateNotifier { final node = _connectedNode; if (node == null || node.uuid.isEmpty) return; final ds = e.urltestResults.where((r) => r.delayMs > 0).map((r) => r.delayMs); - if (ds.isEmpty) return; + if (ds.isEmpty) { + // 诊断:urltest 为空(每 ~10 帧打一次,免刷屏)。 + if (_statsTick++ % 10 == 0) { + logLine('Latency', + 'urltest empty: rawResults=${e.urltestResults.length} node=${node.code} nodePing=${node.ping}'); + } + return; + } final best = ds.reduce((a, b) => a < b ? a : b); + if (_statsTick++ % 10 == 0) logLine('Latency', 'urltest best=${best}ms → setLivePing ${node.code}'); _ref.read(nodesProvider.notifier).setLivePing(node.uuid, best); }