@nockdev/hsa 1.2.3 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dashboard.html +11 -1
- package/package.json +1 -1
package/dashboard.html
CHANGED
|
@@ -1491,6 +1491,8 @@
|
|
|
1491
1491
|
let selectedIde = "";
|
|
1492
1492
|
let selectedProject = "";
|
|
1493
1493
|
let sessionSSERetryMs = 1000;
|
|
1494
|
+
let sessionSSERetryCount = 0;
|
|
1495
|
+
const MAX_SSE_RETRIES = 5;
|
|
1494
1496
|
let fetchErrorCount = 0;
|
|
1495
1497
|
const BASE_REFRESH_MS = 5000;
|
|
1496
1498
|
const MAX_REFRESH_MS = 30000;
|
|
@@ -1507,8 +1509,10 @@
|
|
|
1507
1509
|
localStorage.setItem("hsa_endpoint", endpoint);
|
|
1508
1510
|
setStatus("connecting");
|
|
1509
1511
|
fetchErrorCount = 0; // Reset error counter on manual connect
|
|
1512
|
+
sessionSSERetryCount = 0; // Reset SSE retries so reconnect works
|
|
1510
1513
|
fetchDashboard();
|
|
1511
1514
|
fetchSessions();
|
|
1515
|
+
connectSessionSSE(); // Re-establish SSE stream
|
|
1512
1516
|
}
|
|
1513
1517
|
|
|
1514
1518
|
function setStatus(status) {
|
|
@@ -2235,6 +2239,10 @@
|
|
|
2235
2239
|
}
|
|
2236
2240
|
|
|
2237
2241
|
function connectSessionSSE() {
|
|
2242
|
+
if (sessionSSERetryCount >= MAX_SSE_RETRIES) {
|
|
2243
|
+
console.warn("SSE: Max retries reached, stopping session stream reconnect");
|
|
2244
|
+
return;
|
|
2245
|
+
}
|
|
2238
2246
|
if (sessionSSE) {
|
|
2239
2247
|
sessionSSE.close();
|
|
2240
2248
|
sessionSSE = null;
|
|
@@ -2253,10 +2261,11 @@
|
|
|
2253
2261
|
}
|
|
2254
2262
|
} catch {}
|
|
2255
2263
|
};
|
|
2256
|
-
// FE-02: Auto-reconnect with exponential backoff
|
|
2264
|
+
// FE-02: Auto-reconnect with exponential backoff + max retry cap
|
|
2257
2265
|
sessionSSE.onerror = () => {
|
|
2258
2266
|
sessionSSE.close();
|
|
2259
2267
|
sessionSSE = null;
|
|
2268
|
+
sessionSSERetryCount++;
|
|
2260
2269
|
setTimeout(() => {
|
|
2261
2270
|
connectSessionSSE();
|
|
2262
2271
|
sessionSSERetryMs = Math.min(sessionSSERetryMs * 2, 30000);
|
|
@@ -2264,6 +2273,7 @@
|
|
|
2264
2273
|
};
|
|
2265
2274
|
sessionSSE.onopen = () => {
|
|
2266
2275
|
sessionSSERetryMs = 1000;
|
|
2276
|
+
sessionSSERetryCount = 0;
|
|
2267
2277
|
};
|
|
2268
2278
|
} catch {}
|
|
2269
2279
|
}
|