cross-tab-worker-databus 0.21.18 → 0.21.20
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 +40 -0
- package/dist/centrifuge.js +1 -1
- package/dist/centrifuge.shared.worker.js.map +2 -2
- package/dist/{chunk-KRSD6KHE.js → chunk-VQZXIMXR.js} +20 -6
- package/dist/chunk-VQZXIMXR.js.map +7 -0
- package/dist/cjs/centrifuge.cjs +19 -5
- package/dist/cjs/centrifuge.cjs.map +2 -2
- package/dist/cjs/index.cjs +19 -5
- package/dist/cjs/index.cjs.map +2 -2
- package/dist/core/cluster.d.ts +6 -1
- package/dist/core/cluster.d.ts.map +1 -1
- package/dist/core/replay-persistence.d.ts.map +1 -1
- package/dist/core/trace.d.ts +2 -1
- package/dist/core/trace.d.ts.map +1 -1
- package/dist/core/version.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +2 -2
- package/dist/websocket.d.ts.map +1 -1
- package/dist/workers/port-reaper.d.ts.map +1 -1
- package/docs/roadmap.md +17 -1
- package/docs/zh/roadmap.md +17 -1
- package/package.json +1 -1
- package/dist/chunk-KRSD6KHE.js.map +0 -7
package/dist/cjs/centrifuge.cjs
CHANGED
|
@@ -1915,7 +1915,8 @@ var DataBusTraceReporter = class {
|
|
|
1915
1915
|
* Record that a message was dispatched on `topic`. Pops the oldest receive
|
|
1916
1916
|
* timestamp (FIFO) and increments the latency histogram. Dispatches without
|
|
1917
1917
|
* a matching receive (e.g. broadcast fan-out from another tab) still count
|
|
1918
|
-
* as dispatched but do not produce a latency sample
|
|
1918
|
+
* as dispatched but do not produce a latency sample, and neither does a
|
|
1919
|
+
* dispatch whose delay cannot be computed at all.
|
|
1919
1920
|
*/
|
|
1920
1921
|
recordDispatched(topic) {
|
|
1921
1922
|
if (!this.metricsActive) return;
|
|
@@ -1925,11 +1926,13 @@ var DataBusTraceReporter = class {
|
|
|
1925
1926
|
const receivedTimestamp = queue?.shift();
|
|
1926
1927
|
if (queue && queue.length === 0) this.receivedAt.delete(topic);
|
|
1927
1928
|
if (receivedTimestamp === void 0) return;
|
|
1929
|
+
const delayMs = this.now() - receivedTimestamp;
|
|
1930
|
+
if (!Number.isFinite(delayMs)) return;
|
|
1928
1931
|
this.latencySamples += 1;
|
|
1929
|
-
const
|
|
1930
|
-
const bucketIndex = Math.min(LATENCY_BUCKET_COUNT - 1, Math.floor(
|
|
1932
|
+
const measuredMs = Math.max(0, delayMs);
|
|
1933
|
+
const bucketIndex = Math.min(LATENCY_BUCKET_COUNT - 1, Math.floor(measuredMs / LATENCY_BUCKET_SIZE_MS));
|
|
1931
1934
|
this.latencyBuckets[bucketIndex] = (this.latencyBuckets[bucketIndex] ?? 0) + 1;
|
|
1932
|
-
this.latencySumMs +=
|
|
1935
|
+
this.latencySumMs += measuredMs;
|
|
1933
1936
|
}
|
|
1934
1937
|
/** Record deduplication outcomes for the next metrics window. */
|
|
1935
1938
|
recordDedupAccepted() {
|
|
@@ -2586,7 +2589,18 @@ var DedupManager = class {
|
|
|
2586
2589
|
};
|
|
2587
2590
|
|
|
2588
2591
|
// src/core/version.ts
|
|
2589
|
-
var SDK_VERSION =
|
|
2592
|
+
var SDK_VERSION = (
|
|
2593
|
+
// The `''` arm has zero counts in every coverage run and cannot be lit from a
|
|
2594
|
+
// test: `vitest.config.ts` defines the global for the whole suite, and so does
|
|
2595
|
+
// each bundle `scripts/build.mjs` emits, so reaching this side needs a consumer
|
|
2596
|
+
// that bundles `src/` without passing the define — which is also the only
|
|
2597
|
+
// consumer this module is read by at source level. It cannot be deleted either,
|
|
2598
|
+
// since the declaration's type is `string | undefined` and the export's is
|
|
2599
|
+
// `string` (dropping the conditional is TS2322, measured). Recorded here so the
|
|
2600
|
+
// leg reads as a shape the harness cannot reach rather than as a case nobody
|
|
2601
|
+
// exercised.
|
|
2602
|
+
true ? "0.21.20" : ""
|
|
2603
|
+
);
|
|
2590
2604
|
|
|
2591
2605
|
// src/core/data-bus.ts
|
|
2592
2606
|
var DEFAULT_REPLAY_MAX_PER_TOPIC = 100;
|