cross-tab-worker-databus 0.20.70 → 0.20.71
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 +5 -0
- package/dist/centrifuge.js +1 -1
- package/dist/{chunk-IKBJIREH.js → chunk-D2SIT473.js} +20 -2
- package/dist/{chunk-IKBJIREH.js.map → chunk-D2SIT473.js.map} +2 -2
- package/dist/cjs/centrifuge.cjs +19 -1
- package/dist/cjs/centrifuge.cjs.map +2 -2
- package/dist/cjs/index.cjs +59 -1
- package/dist/cjs/index.cjs.map +2 -2
- package/dist/core/data-bus.d.ts +3 -0
- package/dist/core/data-bus.d.ts.map +1 -1
- package/dist/core/replay-persistence.d.ts +2 -0
- package/dist/core/replay-persistence.d.ts.map +1 -1
- package/dist/index.js +41 -1
- package/dist/index.js.map +2 -2
- package/docs/roadmap.md +5 -1
- package/docs/zh/roadmap.md +5 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/centrifuge.js
CHANGED
|
@@ -1401,6 +1401,8 @@ var CrossTabDataBus = class {
|
|
|
1401
1401
|
persistenceRetryMaxAttempts;
|
|
1402
1402
|
persistenceRetryBackoffMs;
|
|
1403
1403
|
persistenceRetryGeneration = 0;
|
|
1404
|
+
pendingReplayPersistence = [];
|
|
1405
|
+
replayPersistenceFlushScheduled = false;
|
|
1404
1406
|
replayHydration;
|
|
1405
1407
|
// Retention cleanup is coalesced so a burst of publications does not issue
|
|
1406
1408
|
// one IndexedDB read/write transaction per message. The newest cutoff wins.
|
|
@@ -2035,12 +2037,28 @@ var CrossTabDataBus = class {
|
|
|
2035
2037
|
}
|
|
2036
2038
|
}
|
|
2037
2039
|
if (this.replayPersistence) {
|
|
2038
|
-
|
|
2040
|
+
if (this.replayPersistence.appendBatch) {
|
|
2041
|
+
this.pendingReplayPersistence.push(storedMessage);
|
|
2042
|
+
this.scheduleReplayPersistenceFlush();
|
|
2043
|
+
} else {
|
|
2044
|
+
void this.withPersistenceRetry("append", () => this.replayPersistence.append(storedMessage)).catch((error) => this.reportPersistenceError(error));
|
|
2045
|
+
}
|
|
2039
2046
|
if (this.replayRetentionMs !== void 0 && this.replayPersistence.clearBefore) {
|
|
2040
2047
|
this.scheduleReplayRetentionCleanup(this.now() - this.replayRetentionMs);
|
|
2041
2048
|
}
|
|
2042
2049
|
}
|
|
2043
2050
|
}
|
|
2051
|
+
scheduleReplayPersistenceFlush() {
|
|
2052
|
+
if (this.replayPersistenceFlushScheduled) return;
|
|
2053
|
+
this.replayPersistenceFlushScheduled = true;
|
|
2054
|
+
queueMicrotask(() => {
|
|
2055
|
+
this.replayPersistenceFlushScheduled = false;
|
|
2056
|
+
const batch = this.pendingReplayPersistence.splice(0);
|
|
2057
|
+
if (batch.length === 0 || !this.replayPersistence) return;
|
|
2058
|
+
const operation = this.replayPersistence.appendBatch ? () => this.replayPersistence.appendBatch(batch) : () => Promise.all(batch.map((message) => this.replayPersistence.append(message))).then(() => void 0);
|
|
2059
|
+
void this.withPersistenceRetry("append", operation).catch((error) => this.reportPersistenceError(error));
|
|
2060
|
+
});
|
|
2061
|
+
}
|
|
2044
2062
|
async hydrateReplay() {
|
|
2045
2063
|
if (!this.replayBuffers || !this.replayPersistence) {
|
|
2046
2064
|
return;
|
|
@@ -2386,4 +2404,4 @@ export {
|
|
|
2386
2404
|
parseDataBusPublication,
|
|
2387
2405
|
selectWorkerBackend
|
|
2388
2406
|
};
|
|
2389
|
-
//# sourceMappingURL=chunk-
|
|
2407
|
+
//# sourceMappingURL=chunk-D2SIT473.js.map
|