@rotorsoft/act 1.26.0 → 1.27.0
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/dist/.tsbuildinfo +1 -1
- package/dist/@types/adapters/in-memory-store.d.ts +2 -7
- package/dist/@types/adapters/in-memory-store.d.ts.map +1 -1
- package/dist/@types/internal/drain.d.ts +2 -7
- package/dist/@types/internal/drain.d.ts.map +1 -1
- package/dist/@types/types/ports.d.ts +38 -15
- package/dist/@types/types/ports.d.ts.map +1 -1
- package/dist/{chunk-BAIMGDI4.js → chunk-66PTM4QB.js} +23 -6
- package/dist/chunk-66PTM4QB.js.map +1 -0
- package/dist/index.cjs +22 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/test/index.cjs +22 -5
- package/dist/test/index.cjs.map +1 -1
- package/dist/test/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-BAIMGDI4.js.map +0 -1
package/dist/test/index.cjs
CHANGED
|
@@ -479,6 +479,10 @@ var InMemoryStream = class {
|
|
|
479
479
|
// re-claimed (and `retry` is never bumped) until its due-time passes. Unlike
|
|
480
480
|
// in-process backoff, this is durable store state shared across workers.
|
|
481
481
|
_deferred_at = void 0;
|
|
482
|
+
// Work mark (#1485): highest event id observed to resolve to this target.
|
|
483
|
+
// `undefined` means UNKNOWN — the row predates the mark, so `claim` falls
|
|
484
|
+
// back to the legacy has-work probe rather than treating it as "no work".
|
|
485
|
+
_correlated_at = void 0;
|
|
482
486
|
constructor(stream, source, priority = 0, lane = DEFAULT_LANE) {
|
|
483
487
|
this.stream = stream;
|
|
484
488
|
this.source = source;
|
|
@@ -502,6 +506,17 @@ var InMemoryStream = class {
|
|
|
502
506
|
bump_priority(priority) {
|
|
503
507
|
if (priority > this._priority) this._priority = priority;
|
|
504
508
|
}
|
|
509
|
+
get correlated_at() {
|
|
510
|
+
return this._correlated_at;
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Raise the work mark via {@link subscribe}: keeps the maximum, for every
|
|
514
|
+
* value including zero and negatives, so a mark never regresses.
|
|
515
|
+
*/
|
|
516
|
+
mark(correlated_at) {
|
|
517
|
+
if (this._correlated_at === void 0 || correlated_at > this._correlated_at)
|
|
518
|
+
this._correlated_at = correlated_at;
|
|
519
|
+
}
|
|
505
520
|
/**
|
|
506
521
|
* Set the priority outright via {@link prioritize}: operator
|
|
507
522
|
* runtime override that ignores the build-time `max()` invariant.
|
|
@@ -856,6 +871,7 @@ var InMemoryStore = class {
|
|
|
856
871
|
async claim(lagging, leading, by, millis, lane) {
|
|
857
872
|
await sleep();
|
|
858
873
|
const has_work = (s) => {
|
|
874
|
+
if (s.correlated_at !== void 0) return s.at < s.correlated_at;
|
|
859
875
|
if (!s.source) return s.at < this._max_non_snap_event_id;
|
|
860
876
|
if (is_literal_source(s.source)) {
|
|
861
877
|
const max_id = this._max_event_id_by_stream.get(s.source);
|
|
@@ -917,17 +933,18 @@ var InMemoryStore = class {
|
|
|
917
933
|
stream,
|
|
918
934
|
source,
|
|
919
935
|
priority = 0,
|
|
920
|
-
lane = DEFAULT_LANE
|
|
936
|
+
lane = DEFAULT_LANE,
|
|
937
|
+
correlated_at: correlated_at2
|
|
921
938
|
} of streams) {
|
|
922
939
|
const existing = this._streams.get(stream);
|
|
923
940
|
if (existing) {
|
|
924
941
|
existing.bump_priority(priority);
|
|
925
942
|
existing.lane = lane;
|
|
943
|
+
if (correlated_at2 !== void 0) existing.mark(correlated_at2);
|
|
926
944
|
} else {
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
);
|
|
945
|
+
const created = new InMemoryStream(stream, source, priority, lane);
|
|
946
|
+
if (correlated_at2 !== void 0) created.mark(correlated_at2);
|
|
947
|
+
this._streams.set(stream, created);
|
|
931
948
|
subscribed++;
|
|
932
949
|
}
|
|
933
950
|
}
|