cross-tab-worker-databus 0.20.17 → 0.20.18
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-LZ7S62BQ.js → chunk-UN5Q6JUA.js} +10 -6
- package/dist/{chunk-LZ7S62BQ.js.map → chunk-UN5Q6JUA.js.map} +2 -2
- package/dist/cjs/centrifuge.cjs +9 -5
- package/dist/cjs/centrifuge.cjs.map +2 -2
- package/dist/cjs/index.cjs +9 -5
- package/dist/cjs/index.cjs.map +2 -2
- package/dist/core/data-bus.d.ts +5 -1
- 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
|
@@ -1236,7 +1236,7 @@ var PersistenceRetryCancelledError = class extends Error {
|
|
|
1236
1236
|
this.name = "PersistenceRetryCancelledError";
|
|
1237
1237
|
}
|
|
1238
1238
|
};
|
|
1239
|
-
var CrossTabDataBus = class
|
|
1239
|
+
var CrossTabDataBus = class {
|
|
1240
1240
|
transport;
|
|
1241
1241
|
cluster;
|
|
1242
1242
|
// Map of topic → set of local subscribers.
|
|
@@ -1300,7 +1300,7 @@ var CrossTabDataBus = class _CrossTabDataBus {
|
|
|
1300
1300
|
// stop to settle.
|
|
1301
1301
|
pendingStop = null;
|
|
1302
1302
|
// Minimum interval in ms between automatic recovery attempts.
|
|
1303
|
-
|
|
1303
|
+
recoveryCooldownMs;
|
|
1304
1304
|
constructor(options) {
|
|
1305
1305
|
const replay = options.replay;
|
|
1306
1306
|
if (replay) {
|
|
@@ -1330,7 +1330,11 @@ var CrossTabDataBus = class _CrossTabDataBus {
|
|
|
1330
1330
|
if (!Number.isFinite(this.persistenceRetryBackoffMs) || this.persistenceRetryBackoffMs < 0) {
|
|
1331
1331
|
throw new TypeError("replay.persistenceRetry.backoffMs must be a non-negative finite number.");
|
|
1332
1332
|
}
|
|
1333
|
-
const { autoStart, initialConfig, trace, transport, dedup, ...clusterOptions } = options;
|
|
1333
|
+
const { autoStart, initialConfig, trace, transport, dedup, recovery, ...clusterOptions } = options;
|
|
1334
|
+
this.recoveryCooldownMs = recovery?.cooldownMs ?? 1e3;
|
|
1335
|
+
if (!Number.isFinite(this.recoveryCooldownMs) || this.recoveryCooldownMs <= 0) {
|
|
1336
|
+
throw new TypeError("recovery.cooldownMs must be a positive finite number.");
|
|
1337
|
+
}
|
|
1334
1338
|
this.now = dedup?.now ?? Date.now;
|
|
1335
1339
|
this.replayHydration = this.hydrateReplay();
|
|
1336
1340
|
this.transport = transport;
|
|
@@ -1886,7 +1890,7 @@ var CrossTabDataBus = class _CrossTabDataBus {
|
|
|
1886
1890
|
}
|
|
1887
1891
|
if (status === "error" && this.started && !this.stopping) {
|
|
1888
1892
|
const now = this.now();
|
|
1889
|
-
if (now - this.lastRecoveryAt >=
|
|
1893
|
+
if (now - this.lastRecoveryAt >= this.recoveryCooldownMs) {
|
|
1890
1894
|
this.lastRecoveryAt = now;
|
|
1891
1895
|
const attempt = ++this.recoveryAttempt;
|
|
1892
1896
|
this.trace.event({ type: "reliability", operation: "transport_recovery", attempt, outcome: "scheduled" });
|
|
@@ -1894,7 +1898,7 @@ var CrossTabDataBus = class _CrossTabDataBus {
|
|
|
1894
1898
|
if (this.stopping || !this.started || this.suspended) return;
|
|
1895
1899
|
if (this.status !== "error") return;
|
|
1896
1900
|
void this.reopenTransport(attempt);
|
|
1897
|
-
},
|
|
1901
|
+
}, this.recoveryCooldownMs);
|
|
1898
1902
|
}
|
|
1899
1903
|
}
|
|
1900
1904
|
this.invokeHandlers(this.statusHandlers, (handler) => handler(status));
|