cross-tab-worker-databus 0.20.17 → 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 +14 -0
- package/dist/centrifuge.js +1 -1
- package/dist/{chunk-LZ7S62BQ.js → chunk-TC7XXOVN.js} +16 -6
- package/dist/{chunk-LZ7S62BQ.js.map → chunk-TC7XXOVN.js.map} +2 -2
- package/dist/cjs/centrifuge.cjs +15 -5
- package/dist/cjs/centrifuge.cjs.map +2 -2
- package/dist/cjs/index.cjs +15 -5
- package/dist/cjs/index.cjs.map +2 -2
- package/dist/core/data-bus.d.ts +7 -1
- package/dist/core/data-bus.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/docs/configuration.md +2 -0
- package/docs/roadmap.md +11 -1
- package/docs/zh/roadmap.md +11 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
本项目遵循 [Semantic Versioning](https://semver.org/);变更记录格式参考 [Keep a Changelog](https://keepachangelog.com/)。
|
|
4
4
|
|
|
5
|
+
## [0.20.19] - 2026-09-03
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Added optional `recovery.maxAttempts` to cap automatic transport reopen attempts while preserving explicit demand-driven recovery.
|
|
10
|
+
- Added validation and regression coverage for capped recovery sequences.
|
|
11
|
+
|
|
12
|
+
## [0.20.18] - 2026-09-03
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- Added optional `recovery.cooldownMs` to tune automatic transport reopen pacing for different runtime environments.
|
|
17
|
+
- Added validation and fake-timer coverage for custom recovery cooldowns.
|
|
18
|
+
|
|
5
19
|
## [0.20.17] - 2026-09-03
|
|
6
20
|
|
|
7
21
|
### Added
|
package/dist/centrifuge.js
CHANGED
|
@@ -1220,7 +1220,7 @@ var PersistenceRetryCancelledError = class extends Error {
|
|
|
1220
1220
|
this.name = "PersistenceRetryCancelledError";
|
|
1221
1221
|
}
|
|
1222
1222
|
};
|
|
1223
|
-
var CrossTabDataBus = class
|
|
1223
|
+
var CrossTabDataBus = class {
|
|
1224
1224
|
transport;
|
|
1225
1225
|
cluster;
|
|
1226
1226
|
// Map of topic → set of local subscribers.
|
|
@@ -1284,7 +1284,8 @@ var CrossTabDataBus = class _CrossTabDataBus {
|
|
|
1284
1284
|
// stop to settle.
|
|
1285
1285
|
pendingStop = null;
|
|
1286
1286
|
// Minimum interval in ms between automatic recovery attempts.
|
|
1287
|
-
|
|
1287
|
+
recoveryCooldownMs;
|
|
1288
|
+
recoveryMaxAttempts;
|
|
1288
1289
|
constructor(options) {
|
|
1289
1290
|
const replay = options.replay;
|
|
1290
1291
|
if (replay) {
|
|
@@ -1314,7 +1315,15 @@ var CrossTabDataBus = class _CrossTabDataBus {
|
|
|
1314
1315
|
if (!Number.isFinite(this.persistenceRetryBackoffMs) || this.persistenceRetryBackoffMs < 0) {
|
|
1315
1316
|
throw new TypeError("replay.persistenceRetry.backoffMs must be a non-negative finite number.");
|
|
1316
1317
|
}
|
|
1317
|
-
const { autoStart, initialConfig, trace, transport, dedup, ...clusterOptions } = options;
|
|
1318
|
+
const { autoStart, initialConfig, trace, transport, dedup, recovery, ...clusterOptions } = options;
|
|
1319
|
+
this.recoveryCooldownMs = recovery?.cooldownMs ?? 1e3;
|
|
1320
|
+
this.recoveryMaxAttempts = recovery?.maxAttempts ?? Number.POSITIVE_INFINITY;
|
|
1321
|
+
if (!Number.isFinite(this.recoveryCooldownMs) || this.recoveryCooldownMs <= 0) {
|
|
1322
|
+
throw new TypeError("recovery.cooldownMs must be a positive finite number.");
|
|
1323
|
+
}
|
|
1324
|
+
if (!(this.recoveryMaxAttempts === Number.POSITIVE_INFINITY || Number.isSafeInteger(this.recoveryMaxAttempts) && this.recoveryMaxAttempts > 0)) {
|
|
1325
|
+
throw new TypeError("recovery.maxAttempts must be a positive safe integer.");
|
|
1326
|
+
}
|
|
1318
1327
|
this.now = dedup?.now ?? Date.now;
|
|
1319
1328
|
this.replayHydration = this.hydrateReplay();
|
|
1320
1329
|
this.transport = transport;
|
|
@@ -1870,15 +1879,16 @@ var CrossTabDataBus = class _CrossTabDataBus {
|
|
|
1870
1879
|
}
|
|
1871
1880
|
if (status === "error" && this.started && !this.stopping) {
|
|
1872
1881
|
const now = this.now();
|
|
1873
|
-
if (now - this.lastRecoveryAt >=
|
|
1882
|
+
if (now - this.lastRecoveryAt >= this.recoveryCooldownMs) {
|
|
1874
1883
|
this.lastRecoveryAt = now;
|
|
1875
1884
|
const attempt = ++this.recoveryAttempt;
|
|
1885
|
+
if (attempt > this.recoveryMaxAttempts) return;
|
|
1876
1886
|
this.trace.event({ type: "reliability", operation: "transport_recovery", attempt, outcome: "scheduled" });
|
|
1877
1887
|
setTimeout(() => {
|
|
1878
1888
|
if (this.stopping || !this.started || this.suspended) return;
|
|
1879
1889
|
if (this.status !== "error") return;
|
|
1880
1890
|
void this.reopenTransport(attempt);
|
|
1881
|
-
},
|
|
1891
|
+
}, this.recoveryCooldownMs);
|
|
1882
1892
|
}
|
|
1883
1893
|
}
|
|
1884
1894
|
this.invokeHandlers(this.statusHandlers, (handler) => handler(status));
|
|
@@ -2091,4 +2101,4 @@ export {
|
|
|
2091
2101
|
parseDataBusPublication,
|
|
2092
2102
|
selectWorkerBackend
|
|
2093
2103
|
};
|
|
2094
|
-
//# sourceMappingURL=chunk-
|
|
2104
|
+
//# sourceMappingURL=chunk-TC7XXOVN.js.map
|