cross-tab-worker-databus 0.21.18 → 0.21.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 +21 -0
- package/dist/centrifuge.js +1 -1
- package/dist/centrifuge.shared.worker.js.map +2 -2
- package/dist/{chunk-KRSD6KHE.js → chunk-Q2INCAFO.js} +20 -6
- package/dist/{chunk-KRSD6KHE.js.map → chunk-Q2INCAFO.js.map} +2 -2
- 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/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 +9 -1
- package/docs/zh/roadmap.md +9 -1
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -1881,7 +1881,8 @@ var DataBusTraceReporter = class {
|
|
|
1881
1881
|
* Record that a message was dispatched on `topic`. Pops the oldest receive
|
|
1882
1882
|
* timestamp (FIFO) and increments the latency histogram. Dispatches without
|
|
1883
1883
|
* a matching receive (e.g. broadcast fan-out from another tab) still count
|
|
1884
|
-
* as dispatched but do not produce a latency sample
|
|
1884
|
+
* as dispatched but do not produce a latency sample, and neither does a
|
|
1885
|
+
* dispatch whose delay cannot be computed at all.
|
|
1885
1886
|
*/
|
|
1886
1887
|
recordDispatched(topic) {
|
|
1887
1888
|
if (!this.metricsActive) return;
|
|
@@ -1891,11 +1892,13 @@ var DataBusTraceReporter = class {
|
|
|
1891
1892
|
const receivedTimestamp = queue?.shift();
|
|
1892
1893
|
if (queue && queue.length === 0) this.receivedAt.delete(topic);
|
|
1893
1894
|
if (receivedTimestamp === void 0) return;
|
|
1895
|
+
const delayMs = this.now() - receivedTimestamp;
|
|
1896
|
+
if (!Number.isFinite(delayMs)) return;
|
|
1894
1897
|
this.latencySamples += 1;
|
|
1895
|
-
const
|
|
1896
|
-
const bucketIndex = Math.min(LATENCY_BUCKET_COUNT - 1, Math.floor(
|
|
1898
|
+
const measuredMs = Math.max(0, delayMs);
|
|
1899
|
+
const bucketIndex = Math.min(LATENCY_BUCKET_COUNT - 1, Math.floor(measuredMs / LATENCY_BUCKET_SIZE_MS));
|
|
1897
1900
|
this.latencyBuckets[bucketIndex] = (this.latencyBuckets[bucketIndex] ?? 0) + 1;
|
|
1898
|
-
this.latencySumMs +=
|
|
1901
|
+
this.latencySumMs += measuredMs;
|
|
1899
1902
|
}
|
|
1900
1903
|
/** Record deduplication outcomes for the next metrics window. */
|
|
1901
1904
|
recordDedupAccepted() {
|
|
@@ -2552,7 +2555,18 @@ var DedupManager = class {
|
|
|
2552
2555
|
};
|
|
2553
2556
|
|
|
2554
2557
|
// src/core/version.ts
|
|
2555
|
-
var SDK_VERSION =
|
|
2558
|
+
var SDK_VERSION = (
|
|
2559
|
+
// The `''` arm has zero counts in every coverage run and cannot be lit from a
|
|
2560
|
+
// test: `vitest.config.ts` defines the global for the whole suite, and so does
|
|
2561
|
+
// each bundle `scripts/build.mjs` emits, so reaching this side needs a consumer
|
|
2562
|
+
// that bundles `src/` without passing the define — which is also the only
|
|
2563
|
+
// consumer this module is read by at source level. It cannot be deleted either,
|
|
2564
|
+
// since the declaration's type is `string | undefined` and the export's is
|
|
2565
|
+
// `string` (dropping the conditional is TS2322, measured). Recorded here so the
|
|
2566
|
+
// leg reads as a shape the harness cannot reach rather than as a case nobody
|
|
2567
|
+
// exercised.
|
|
2568
|
+
true ? "0.21.19" : ""
|
|
2569
|
+
);
|
|
2556
2570
|
|
|
2557
2571
|
// src/core/data-bus.ts
|
|
2558
2572
|
var DEFAULT_REPLAY_MAX_PER_TOPIC = 100;
|