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/index.cjs
CHANGED
|
@@ -1261,7 +1261,7 @@ var PersistenceRetryCancelledError = class extends Error {
|
|
|
1261
1261
|
this.name = "PersistenceRetryCancelledError";
|
|
1262
1262
|
}
|
|
1263
1263
|
};
|
|
1264
|
-
var CrossTabDataBus = class
|
|
1264
|
+
var CrossTabDataBus = class {
|
|
1265
1265
|
transport;
|
|
1266
1266
|
cluster;
|
|
1267
1267
|
// Map of topic → set of local subscribers.
|
|
@@ -1325,7 +1325,7 @@ var CrossTabDataBus = class _CrossTabDataBus {
|
|
|
1325
1325
|
// stop to settle.
|
|
1326
1326
|
pendingStop = null;
|
|
1327
1327
|
// Minimum interval in ms between automatic recovery attempts.
|
|
1328
|
-
|
|
1328
|
+
recoveryCooldownMs;
|
|
1329
1329
|
constructor(options) {
|
|
1330
1330
|
const replay = options.replay;
|
|
1331
1331
|
if (replay) {
|
|
@@ -1355,7 +1355,11 @@ var CrossTabDataBus = class _CrossTabDataBus {
|
|
|
1355
1355
|
if (!Number.isFinite(this.persistenceRetryBackoffMs) || this.persistenceRetryBackoffMs < 0) {
|
|
1356
1356
|
throw new TypeError("replay.persistenceRetry.backoffMs must be a non-negative finite number.");
|
|
1357
1357
|
}
|
|
1358
|
-
const { autoStart, initialConfig, trace, transport, dedup, ...clusterOptions } = options;
|
|
1358
|
+
const { autoStart, initialConfig, trace, transport, dedup, recovery, ...clusterOptions } = options;
|
|
1359
|
+
this.recoveryCooldownMs = recovery?.cooldownMs ?? 1e3;
|
|
1360
|
+
if (!Number.isFinite(this.recoveryCooldownMs) || this.recoveryCooldownMs <= 0) {
|
|
1361
|
+
throw new TypeError("recovery.cooldownMs must be a positive finite number.");
|
|
1362
|
+
}
|
|
1359
1363
|
this.now = dedup?.now ?? Date.now;
|
|
1360
1364
|
this.replayHydration = this.hydrateReplay();
|
|
1361
1365
|
this.transport = transport;
|
|
@@ -1911,7 +1915,7 @@ var CrossTabDataBus = class _CrossTabDataBus {
|
|
|
1911
1915
|
}
|
|
1912
1916
|
if (status === "error" && this.started && !this.stopping) {
|
|
1913
1917
|
const now = this.now();
|
|
1914
|
-
if (now - this.lastRecoveryAt >=
|
|
1918
|
+
if (now - this.lastRecoveryAt >= this.recoveryCooldownMs) {
|
|
1915
1919
|
this.lastRecoveryAt = now;
|
|
1916
1920
|
const attempt = ++this.recoveryAttempt;
|
|
1917
1921
|
this.trace.event({ type: "reliability", operation: "transport_recovery", attempt, outcome: "scheduled" });
|
|
@@ -1919,7 +1923,7 @@ var CrossTabDataBus = class _CrossTabDataBus {
|
|
|
1919
1923
|
if (this.stopping || !this.started || this.suspended) return;
|
|
1920
1924
|
if (this.status !== "error") return;
|
|
1921
1925
|
void this.reopenTransport(attempt);
|
|
1922
|
-
},
|
|
1926
|
+
}, this.recoveryCooldownMs);
|
|
1923
1927
|
}
|
|
1924
1928
|
}
|
|
1925
1929
|
this.invokeHandlers(this.statusHandlers, (handler) => handler(status));
|