@chromahq/react 1.0.40 → 1.0.41
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/dist/index.js +11 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,26 +5,27 @@ const BRIDGE_ENABLE_LOGS = true;
|
|
|
5
5
|
const CONFIG = {
|
|
6
6
|
RETRY_AFTER: 1e3,
|
|
7
7
|
MAX_RETRIES: 10,
|
|
8
|
-
PING_INTERVAL:
|
|
9
|
-
// Check every
|
|
8
|
+
PING_INTERVAL: 15e3,
|
|
9
|
+
// Check every 15s (tolerant of long operations)
|
|
10
10
|
MAX_RETRY_COOLDOWN: 3e4,
|
|
11
|
-
DEFAULT_TIMEOUT:
|
|
12
|
-
//
|
|
11
|
+
DEFAULT_TIMEOUT: 6e4,
|
|
12
|
+
// 60s default for slow operations
|
|
13
13
|
MAX_RETRY_DELAY: 3e4,
|
|
14
|
-
PING_TIMEOUT:
|
|
15
|
-
// Give SW
|
|
14
|
+
PING_TIMEOUT: 2e4,
|
|
15
|
+
// Give SW 20s to respond to ping
|
|
16
16
|
ERROR_CHECK_INTERVAL: 100,
|
|
17
17
|
MAX_ERROR_CHECKS: 10,
|
|
18
18
|
CONSECUTIVE_FAILURE_THRESHOLD: 5,
|
|
19
|
-
// Require 5 consecutive failures (
|
|
19
|
+
// Require 5 consecutive failures (75s total) before reconnecting
|
|
20
20
|
RECONNECT_DELAY: 100,
|
|
21
21
|
PORT_NAME: "chroma-bridge",
|
|
22
22
|
// Service worker restart retry settings (indefinite retries)
|
|
23
23
|
SW_RESTART_RETRY_DELAY: 500,
|
|
24
24
|
SW_RESTART_MAX_DELAY: 5e3,
|
|
25
25
|
// Threshold for counting timeouts toward reconnection (only count fast timeouts as failures)
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
// Requests with timeout > this value are considered intentional long operations
|
|
27
|
+
TIMEOUT_FAILURE_THRESHOLD_MS: 3e4
|
|
28
|
+
// Only count timeouts < 30s as potential SW issues
|
|
28
29
|
};
|
|
29
30
|
const calculateBackoffDelay = (attempt, baseDelay, maxDelay) => Math.min(baseDelay * Math.pow(2, attempt - 1), maxDelay);
|
|
30
31
|
const clearTimeoutSafe = (ref) => {
|
|
@@ -559,7 +560,7 @@ const BridgeProvider = ({
|
|
|
559
560
|
if (BRIDGE_ENABLE_LOGS) {
|
|
560
561
|
console.log("[Bridge] Grace period ended, timeout monitoring active");
|
|
561
562
|
}
|
|
562
|
-
},
|
|
563
|
+
}, 1e4);
|
|
563
564
|
eventListenersRef.current.get("bridge:connected")?.forEach((handler) => {
|
|
564
565
|
try {
|
|
565
566
|
handler({ timestamp: Date.now() });
|