Skip to content

#1 Persistent memory for AI coding agents based on real-world benchmarks

fix(viewer): re-probe WS during polling, dedupe dashboard refresh

Rohit Ghumare84ac801bd80c
diff --git a/src/viewer/index.html b/src/viewer/index.html
index 9d12c24e..956b611a 100644
--- a/src/viewer/index.html
+++ b/src/viewer/index.html
@@ -1281,6 +1281,7 @@
function startDashboardAutoRefresh() {
if (dashboardTimer) clearInterval(dashboardTimer);
dashboardTimer = setInterval(function() {
+ if (pollTimer) return;
if (state.activeTab === 'dashboard') refreshDashboard();
}, 30000);
}
@@ -2848,10 +2849,14 @@
el.className = 'ws-status ' + cls;
}
+ var WS_REPROBE_EVERY_TICKS = 6;
+
function startPolling() {
if (pollTimer) return;
setWsStatus('polling · ' + (POLL_INTERVAL_MS / 1000) + 's', 'disconnected');
+ var tick = 0;
pollTimer = setInterval(function() {
+ tick++;
if (state.activeTab === 'dashboard') {
state.dashboard.loaded = false;
loadDashboard();
@@ -2865,6 +2870,15 @@
state.activity.loaded = false;
loadActivity();
}
+ if (tick % WS_REPROBE_EVERY_TICKS === 0) {
+ var ws = state.ws;
+ if (!ws || ws.readyState !== WebSocket.OPEN) {
+ wsRetries = 0;
+ directFailures = 0;
+ directFailed = false;
+ connectWs();
+ }
+ }
}, POLL_INTERVAL_MS);
}