cross-tab-worker-databus 0.20.58 → 0.20.59
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 +6 -0
- package/dist/centrifuge.js +1 -1
- package/dist/{chunk-BWSJUUUP.js → chunk-RAUX7RZC.js} +27 -3
- package/dist/{chunk-BWSJUUUP.js.map → chunk-RAUX7RZC.js.map} +2 -2
- package/dist/cjs/centrifuge.cjs +26 -2
- package/dist/cjs/centrifuge.cjs.map +2 -2
- package/dist/cjs/index.cjs +26 -2
- package/dist/cjs/index.cjs.map +2 -2
- package/dist/core/data-bus.d.ts +13 -0
- package/dist/core/data-bus.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/docs/roadmap.md +5 -1
- package/docs/zh/roadmap.md +5 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
+
## [0.20.59] - 2026-09-04
|
|
3
|
+
|
|
4
|
+
### Added
|
|
5
|
+
- Extended `CrossTabDataBus.getRecoveryStats()` with `generation` (monotonic counter incremented on every successful transport open) and `lastSuccessAt` (timestamp of the most recent successful open, or `null` until the transport reaches `ready`).
|
|
6
|
+
- Added a unit test asserting generation/lastSuccessAt advance on the initial start and after a recovery, and stay stable across failed recovery attempts.
|
|
7
|
+
|
|
2
8
|
## [0.20.58] - 2026-09-04
|
|
3
9
|
|
|
4
10
|
### Changed
|
package/dist/centrifuge.js
CHANGED
|
@@ -1316,6 +1316,13 @@ var CrossTabDataBus = class {
|
|
|
1316
1316
|
// a transport reopen succeeds so traces can correlate repeated failures.
|
|
1317
1317
|
recoveryAttempt = 0;
|
|
1318
1318
|
recoveryExhausted = false;
|
|
1319
|
+
/** Monotonic generation incremented on every successful transport open.
|
|
1320
|
+
* Stays in lockstep with `lastSuccessAt` so callers can detect that the
|
|
1321
|
+
* transport has been reopened even if the timestamp window is short. */
|
|
1322
|
+
recoveryGeneration = 0;
|
|
1323
|
+
/** Timestamp of the most recent successful transport open. Null until the
|
|
1324
|
+
* transport has reached the `ready` state at least once. */
|
|
1325
|
+
lastSuccessAt = null;
|
|
1319
1326
|
// True while the tab is hidden so an in-flight transport start does not mark
|
|
1320
1327
|
// the transport ready after suspendTransport() has stopped it.
|
|
1321
1328
|
suspended = false;
|
|
@@ -1509,7 +1516,11 @@ var CrossTabDataBus = class {
|
|
|
1509
1516
|
if (this.status === "error") {
|
|
1510
1517
|
throw new Error("Transport failed during startup.");
|
|
1511
1518
|
}
|
|
1512
|
-
if (!this.suspended && !this.stopping)
|
|
1519
|
+
if (!this.suspended && !this.stopping) {
|
|
1520
|
+
this.recoveryGeneration += 1;
|
|
1521
|
+
this.lastSuccessAt = this.now();
|
|
1522
|
+
this.transportReady = true;
|
|
1523
|
+
}
|
|
1513
1524
|
});
|
|
1514
1525
|
}).catch((error) => {
|
|
1515
1526
|
if (stopClusterOnFailure) this.started = false;
|
|
@@ -1679,9 +1690,22 @@ var CrossTabDataBus = class {
|
|
|
1679
1690
|
return this.status;
|
|
1680
1691
|
}
|
|
1681
1692
|
/** Return the current automatic transport recovery state. `hasError` means a transport error is currently retained. */
|
|
1693
|
+
/** Return the current automatic transport recovery state plus diagnostics.
|
|
1694
|
+
* `generation` increments on every successful transport open (initial start
|
|
1695
|
+
* and every recovery); `lastSuccessAt` is the timestamp of the most recent
|
|
1696
|
+
* successful open, or `null` until the transport reaches `ready`. */
|
|
1682
1697
|
getRecoveryStats() {
|
|
1683
1698
|
const errorMessage = this.lastError instanceof Error ? this.lastError.message : this.lastError === null ? null : String(this.lastError);
|
|
1684
|
-
return {
|
|
1699
|
+
return {
|
|
1700
|
+
attempt: this.recoveryAttempt,
|
|
1701
|
+
exhausted: this.recoveryExhausted,
|
|
1702
|
+
maxAttempts: this.recoveryMaxAttempts,
|
|
1703
|
+
hasError: this.lastError !== null,
|
|
1704
|
+
errorMessage,
|
|
1705
|
+
errorAt: this.lastErrorAt,
|
|
1706
|
+
generation: this.recoveryGeneration,
|
|
1707
|
+
lastSuccessAt: this.lastSuccessAt
|
|
1708
|
+
};
|
|
1685
1709
|
}
|
|
1686
1710
|
/** Snapshot of the cluster state (workers, routes, assignments).
|
|
1687
1711
|
* For diagnostics only — the returned object is a shallow copy but
|
|
@@ -2158,4 +2182,4 @@ export {
|
|
|
2158
2182
|
parseDataBusPublication,
|
|
2159
2183
|
selectWorkerBackend
|
|
2160
2184
|
};
|
|
2161
|
-
//# sourceMappingURL=chunk-
|
|
2185
|
+
//# sourceMappingURL=chunk-RAUX7RZC.js.map
|