@rotorsoft/act 1.32.15 → 1.32.16
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/internal/drain-cycle.d.ts +12 -9
- package/dist/@types/internal/drain-cycle.d.ts.map +1 -1
- package/dist/@types/types/action.d.ts +5 -7
- package/dist/@types/types/action.d.ts.map +1 -1
- package/dist/@types/types/reaction.d.ts +7 -12
- package/dist/@types/types/reaction.d.ts.map +1 -1
- package/dist/index.cjs +16 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1684,7 +1684,7 @@ var CorrelateCycle = class {
|
|
|
1684
1684
|
this._initialized = true;
|
|
1685
1685
|
}
|
|
1686
1686
|
async _run_init() {
|
|
1687
|
-
const { watermark, correlated_at } = await
|
|
1687
|
+
const { watermark, correlated_at } = await this._cd.subscribe([
|
|
1688
1688
|
...this._static_targets
|
|
1689
1689
|
]);
|
|
1690
1690
|
this._checkpoint = correlated_at >= 0 ? correlated_at : Math.max(-1, watermark - this._cold_start_back_scan);
|
|
@@ -2756,7 +2756,16 @@ function warn_misrouted(seen, stream, handler, event) {
|
|
|
2756
2756
|
`Reaction "${handler}" on "${event}" resolved to target "${stream}", which a projection already serves. A target is served by one batch handler or one state projection, so this reaction can never run \u2014 and delivering to it would hand the projection an aggregate from another stream. Skipping it. The equivalent static \`.to({ target })\` is rejected at build; a dynamic resolver's target is only knowable here.`
|
|
2757
2757
|
);
|
|
2758
2758
|
}
|
|
2759
|
-
async function run_drain_cycle(
|
|
2759
|
+
async function run_drain_cycle(deps, cycle) {
|
|
2760
|
+
const { ops, registry, batch_handlers, handle, handle_batch, lane } = deps;
|
|
2761
|
+
const {
|
|
2762
|
+
lagging,
|
|
2763
|
+
leading,
|
|
2764
|
+
eventLimit,
|
|
2765
|
+
leaseMillis,
|
|
2766
|
+
misrouted,
|
|
2767
|
+
store_failing
|
|
2768
|
+
} = cycle;
|
|
2760
2769
|
const leased = await ops.claim(
|
|
2761
2770
|
lagging,
|
|
2762
2771
|
leading,
|
|
@@ -2828,7 +2837,7 @@ async function run_drain_cycle(ops, registry, batch_handlers, misrouted, store_f
|
|
|
2828
2837
|
const blocked = await ops.block(
|
|
2829
2838
|
handled.filter(({ block: block2 }) => block2).map(({ lease, error }) => ({ ...lease, error }))
|
|
2830
2839
|
);
|
|
2831
|
-
if (blocked.length) on_blocked(blocked);
|
|
2840
|
+
if (blocked.length) deps.on_blocked(blocked);
|
|
2832
2841
|
const submitted = handled.flatMap((h, i) => {
|
|
2833
2842
|
const advance = h.handled > 0 ? h.acked_at : leased[i].at;
|
|
2834
2843
|
return h.defer !== void 0 ? { ...h.lease, at: advance, due: h.defer, retry: -1 } : h.next_attempt_at !== void 0 ? { ...h.lease, at: advance, due: h.next_attempt_at } : h.handled > 0 || !h.error ? { ...h.lease, at: h.acked_at } : [];
|
|
@@ -2959,21 +2968,14 @@ var DrainController = class {
|
|
|
2959
2968
|
});
|
|
2960
2969
|
const lagging = Math.ceil(streamLimit * this._ratio);
|
|
2961
2970
|
const leading = streamLimit - lagging;
|
|
2962
|
-
const cycle = await run_drain_cycle(
|
|
2963
|
-
this._deps.ops,
|
|
2964
|
-
this._deps.registry,
|
|
2965
|
-
this._deps.batch_handlers,
|
|
2966
|
-
this._misrouted,
|
|
2967
|
-
this._deps.breaker.failing,
|
|
2968
|
-
this._deps.handle,
|
|
2969
|
-
this._deps.handle_batch,
|
|
2971
|
+
const cycle = await run_drain_cycle(this._deps, {
|
|
2970
2972
|
lagging,
|
|
2971
2973
|
leading,
|
|
2972
2974
|
eventLimit,
|
|
2973
2975
|
leaseMillis,
|
|
2974
|
-
|
|
2975
|
-
this._deps.
|
|
2976
|
-
);
|
|
2976
|
+
misrouted: this._misrouted,
|
|
2977
|
+
store_failing: this._deps.breaker.failing
|
|
2978
|
+
});
|
|
2977
2979
|
if (!cycle) {
|
|
2978
2980
|
this._deps.breaker.passed();
|
|
2979
2981
|
this._armed = false;
|