diag(client): _onStats 加 urltest 诊断日志,定位延迟显示 — 根因
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -87,6 +87,7 @@ class ConnectionController extends StateNotifier<ConnectionState> {
|
|||||||
Timer? _elapsed;
|
Timer? _elapsed;
|
||||||
Timer? _watchdog;
|
Timer? _watchdog;
|
||||||
bool _probing = false;
|
bool _probing = false;
|
||||||
|
int _statsTick = 0; // 仅诊断:_onStats 限频打日志
|
||||||
// 本次 off 的提示语(节点异常/自动切换);kernel off 与显式断开都读它,避免被互相覆盖。
|
// 本次 off 的提示语(节点异常/自动切换);kernel off 与显式断开都读它,避免被互相覆盖。
|
||||||
// 仅 _connect 开始时清空。用户主动断开则保持 null(无提示)。
|
// 仅 _connect 开始时清空。用户主动断开则保持 null(无提示)。
|
||||||
String? _offNotice;
|
String? _offNotice;
|
||||||
@@ -232,8 +233,16 @@ class ConnectionController extends StateNotifier<ConnectionState> {
|
|||||||
final node = _connectedNode;
|
final node = _connectedNode;
|
||||||
if (node == null || node.uuid.isEmpty) return;
|
if (node == null || node.uuid.isEmpty) return;
|
||||||
final ds = e.urltestResults.where((r) => r.delayMs > 0).map((r) => r.delayMs);
|
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);
|
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);
|
_ref.read(nodesProvider.notifier).setLivePing(node.uuid, best);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user