cross-tab-worker-databus 0.20.18 → 0.20.20
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/CHANGELOG.md +13 -0
- package/dist/centrifuge.js +1 -1
- package/dist/{chunk-UN5Q6JUA.js → chunk-2PUSQWOL.js} +10 -1
- package/dist/{chunk-UN5Q6JUA.js.map → chunk-2PUSQWOL.js.map} +2 -2
- package/dist/cjs/centrifuge.cjs +9 -0
- package/dist/cjs/centrifuge.cjs.map +2 -2
- package/dist/cjs/index.cjs +9 -0
- package/dist/cjs/index.cjs.map +2 -2
- package/dist/core/data-bus.d.ts +2 -0
- package/dist/core/data-bus.d.ts.map +1 -1
- package/dist/core/trace.d.ts +1 -1
- package/dist/core/trace.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/docs/configuration.md +1 -0
- package/docs/roadmap.md +10 -1
- package/docs/zh/roadmap.md +10 -1
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -1326,6 +1326,7 @@ var CrossTabDataBus = class {
|
|
|
1326
1326
|
pendingStop = null;
|
|
1327
1327
|
// Minimum interval in ms between automatic recovery attempts.
|
|
1328
1328
|
recoveryCooldownMs;
|
|
1329
|
+
recoveryMaxAttempts;
|
|
1329
1330
|
constructor(options) {
|
|
1330
1331
|
const replay = options.replay;
|
|
1331
1332
|
if (replay) {
|
|
@@ -1357,9 +1358,13 @@ var CrossTabDataBus = class {
|
|
|
1357
1358
|
}
|
|
1358
1359
|
const { autoStart, initialConfig, trace, transport, dedup, recovery, ...clusterOptions } = options;
|
|
1359
1360
|
this.recoveryCooldownMs = recovery?.cooldownMs ?? 1e3;
|
|
1361
|
+
this.recoveryMaxAttempts = recovery?.maxAttempts ?? Number.POSITIVE_INFINITY;
|
|
1360
1362
|
if (!Number.isFinite(this.recoveryCooldownMs) || this.recoveryCooldownMs <= 0) {
|
|
1361
1363
|
throw new TypeError("recovery.cooldownMs must be a positive finite number.");
|
|
1362
1364
|
}
|
|
1365
|
+
if (!(this.recoveryMaxAttempts === Number.POSITIVE_INFINITY || Number.isSafeInteger(this.recoveryMaxAttempts) && this.recoveryMaxAttempts > 0)) {
|
|
1366
|
+
throw new TypeError("recovery.maxAttempts must be a positive safe integer.");
|
|
1367
|
+
}
|
|
1363
1368
|
this.now = dedup?.now ?? Date.now;
|
|
1364
1369
|
this.replayHydration = this.hydrateReplay();
|
|
1365
1370
|
this.transport = transport;
|
|
@@ -1918,6 +1923,10 @@ var CrossTabDataBus = class {
|
|
|
1918
1923
|
if (now - this.lastRecoveryAt >= this.recoveryCooldownMs) {
|
|
1919
1924
|
this.lastRecoveryAt = now;
|
|
1920
1925
|
const attempt = ++this.recoveryAttempt;
|
|
1926
|
+
if (attempt > this.recoveryMaxAttempts) {
|
|
1927
|
+
this.trace.event({ type: "reliability", operation: "transport_recovery", attempt: this.recoveryMaxAttempts, outcome: "exhausted" });
|
|
1928
|
+
return;
|
|
1929
|
+
}
|
|
1921
1930
|
this.trace.event({ type: "reliability", operation: "transport_recovery", attempt, outcome: "scheduled" });
|
|
1922
1931
|
setTimeout(() => {
|
|
1923
1932
|
if (this.stopping || !this.started || this.suspended) return;
|