cross-tab-worker-databus 0.20.18 → 0.20.19
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 +7 -0
- package/dist/centrifuge.js +1 -1
- package/dist/{chunk-UN5Q6JUA.js → chunk-TC7XXOVN.js} +7 -1
- package/dist/{chunk-UN5Q6JUA.js.map → chunk-TC7XXOVN.js.map} +2 -2
- package/dist/cjs/centrifuge.cjs +6 -0
- package/dist/cjs/centrifuge.cjs.map +2 -2
- package/dist/cjs/index.cjs +6 -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/index.js +1 -1
- package/docs/configuration.md +1 -0
- package/docs/roadmap.md +6 -1
- package/docs/zh/roadmap.md +6 -1
- package/package.json +1 -1
package/dist/cjs/centrifuge.cjs
CHANGED
|
@@ -1301,6 +1301,7 @@ var CrossTabDataBus = class {
|
|
|
1301
1301
|
pendingStop = null;
|
|
1302
1302
|
// Minimum interval in ms between automatic recovery attempts.
|
|
1303
1303
|
recoveryCooldownMs;
|
|
1304
|
+
recoveryMaxAttempts;
|
|
1304
1305
|
constructor(options) {
|
|
1305
1306
|
const replay = options.replay;
|
|
1306
1307
|
if (replay) {
|
|
@@ -1332,9 +1333,13 @@ var CrossTabDataBus = class {
|
|
|
1332
1333
|
}
|
|
1333
1334
|
const { autoStart, initialConfig, trace, transport, dedup, recovery, ...clusterOptions } = options;
|
|
1334
1335
|
this.recoveryCooldownMs = recovery?.cooldownMs ?? 1e3;
|
|
1336
|
+
this.recoveryMaxAttempts = recovery?.maxAttempts ?? Number.POSITIVE_INFINITY;
|
|
1335
1337
|
if (!Number.isFinite(this.recoveryCooldownMs) || this.recoveryCooldownMs <= 0) {
|
|
1336
1338
|
throw new TypeError("recovery.cooldownMs must be a positive finite number.");
|
|
1337
1339
|
}
|
|
1340
|
+
if (!(this.recoveryMaxAttempts === Number.POSITIVE_INFINITY || Number.isSafeInteger(this.recoveryMaxAttempts) && this.recoveryMaxAttempts > 0)) {
|
|
1341
|
+
throw new TypeError("recovery.maxAttempts must be a positive safe integer.");
|
|
1342
|
+
}
|
|
1338
1343
|
this.now = dedup?.now ?? Date.now;
|
|
1339
1344
|
this.replayHydration = this.hydrateReplay();
|
|
1340
1345
|
this.transport = transport;
|
|
@@ -1893,6 +1898,7 @@ var CrossTabDataBus = class {
|
|
|
1893
1898
|
if (now - this.lastRecoveryAt >= this.recoveryCooldownMs) {
|
|
1894
1899
|
this.lastRecoveryAt = now;
|
|
1895
1900
|
const attempt = ++this.recoveryAttempt;
|
|
1901
|
+
if (attempt > this.recoveryMaxAttempts) return;
|
|
1896
1902
|
this.trace.event({ type: "reliability", operation: "transport_recovery", attempt, outcome: "scheduled" });
|
|
1897
1903
|
setTimeout(() => {
|
|
1898
1904
|
if (this.stopping || !this.started || this.suspended) return;
|