@rotorsoft/act 1.32.7 → 1.32.9
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/README.md +1 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/@types/act.d.ts.map +1 -1
- package/dist/@types/adapters/in-memory-store.d.ts.map +1 -1
- package/dist/@types/builders/act-builder.d.ts.map +1 -1
- package/dist/@types/internal/correlate-cycle.d.ts +11 -0
- package/dist/@types/internal/correlate-cycle.d.ts.map +1 -1
- package/dist/@types/internal/drain-cycle.d.ts.map +1 -1
- package/dist/@types/types/ports.d.ts +9 -0
- package/dist/@types/types/ports.d.ts.map +1 -1
- package/dist/{chunk-7OAW4YMO.js → chunk-F4F5AKM3.js} +9 -1
- package/dist/{chunk-7OAW4YMO.js.map → chunk-F4F5AKM3.js.map} +1 -1
- package/dist/index.cjs +45 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +38 -2
- package/dist/index.js.map +1 -1
- package/dist/test/index.cjs +8 -0
- package/dist/test/index.cjs.map +1 -1
- package/dist/test/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
sleep,
|
|
27
27
|
store,
|
|
28
28
|
validate
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-F4F5AKM3.js";
|
|
30
30
|
import {
|
|
31
31
|
ActorSchema,
|
|
32
32
|
CausationEventSchema,
|
|
@@ -1742,6 +1742,24 @@ var CorrelateCycle = class {
|
|
|
1742
1742
|
* `_static_subscriptions`, which this never touches, so they stay pinned
|
|
1743
1743
|
* at +Infinity and the dynamic path never re-opens them.
|
|
1744
1744
|
*/
|
|
1745
|
+
/**
|
|
1746
|
+
* Start correlation over after the event log was replaced wholesale
|
|
1747
|
+
* (`restore`). The restored log is renumbered from the start and its
|
|
1748
|
+
* subscription rows are gone, so the in-memory scan position and both
|
|
1749
|
+
* subscription records describe a log that no longer exists. Dropping them
|
|
1750
|
+
* and the init latch makes the next pass run cold-start again: static
|
|
1751
|
+
* targets are re-subscribed, the checkpoint is re-read from the store
|
|
1752
|
+
* (which `restore` reset), and dynamic targets are rediscovered by the
|
|
1753
|
+
* scan (#1772).
|
|
1754
|
+
*/
|
|
1755
|
+
restart() {
|
|
1756
|
+
this._initialized = false;
|
|
1757
|
+
this._init_promise = void 0;
|
|
1758
|
+
this._checkpoint = -1;
|
|
1759
|
+
this._dynamic_subscriptions.clear();
|
|
1760
|
+
this._static_subscriptions.clear();
|
|
1761
|
+
this._armed = true;
|
|
1762
|
+
}
|
|
1745
1763
|
forget_subscribed(streams) {
|
|
1746
1764
|
for (const stream of streams) this._dynamic_subscriptions.delete(stream);
|
|
1747
1765
|
}
|
|
@@ -2831,6 +2849,16 @@ function budget_exhausted(lease, options, store_failing) {
|
|
|
2831
2849
|
log().error(error);
|
|
2832
2850
|
return { lease, handled: 0, acked_at: lease.at, error, block: true };
|
|
2833
2851
|
}
|
|
2852
|
+
function fetch_failure_policy(registry) {
|
|
2853
|
+
let blockOnError = true;
|
|
2854
|
+
let maxRetries = 0;
|
|
2855
|
+
for (const register of Object.values(registry.events))
|
|
2856
|
+
for (const reaction of register.reactions.values()) {
|
|
2857
|
+
blockOnError &&= reaction.options.blockOnError;
|
|
2858
|
+
maxRetries = Math.max(maxRetries, reaction.options.maxRetries);
|
|
2859
|
+
}
|
|
2860
|
+
return { blockOnError, maxRetries };
|
|
2861
|
+
}
|
|
2834
2862
|
function warn_misrouted(seen, stream, handler, event) {
|
|
2835
2863
|
report_once(
|
|
2836
2864
|
seen,
|
|
@@ -2881,11 +2909,14 @@ async function run_drain_cycle(ops, registry, batch_handlers, misrouted, store_f
|
|
|
2881
2909
|
if (entry.fetch.error !== void 0) {
|
|
2882
2910
|
const error = `Fetch failed for ${lease.stream}: ${entry.fetch.error}`;
|
|
2883
2911
|
log().error(error);
|
|
2912
|
+
const policy = fetch_failure_policy(registry);
|
|
2913
|
+
const block2 = !store_failing && policy.blockOnError && lease.retry >= policy.maxRetries;
|
|
2884
2914
|
const failed = {
|
|
2885
2915
|
lease,
|
|
2886
2916
|
handled: 0,
|
|
2887
2917
|
acked_at: lease.at,
|
|
2888
|
-
error
|
|
2918
|
+
error,
|
|
2919
|
+
...block2 ? { block: true } : {}
|
|
2889
2920
|
};
|
|
2890
2921
|
return Promise.resolve(failed);
|
|
2891
2922
|
}
|
|
@@ -4683,6 +4714,10 @@ var Act = class {
|
|
|
4683
4714
|
migrated = partial.migrated;
|
|
4684
4715
|
dropped = partial.dropped;
|
|
4685
4716
|
});
|
|
4717
|
+
if (!sink) {
|
|
4718
|
+
this._correlate.restart();
|
|
4719
|
+
this._arm_all();
|
|
4720
|
+
}
|
|
4686
4721
|
return { kept, migrated, dropped, duration_ms: Date.now() - started };
|
|
4687
4722
|
});
|
|
4688
4723
|
}
|
|
@@ -5352,6 +5387,7 @@ function act() {
|
|
|
5352
5387
|
const pending_projections = [];
|
|
5353
5388
|
const projection_reactions = /* @__PURE__ */ new Set();
|
|
5354
5389
|
const record_projection_reactions = (proj) => {
|
|
5390
|
+
if (!proj.batchHandler && !proj.fold) return;
|
|
5355
5391
|
for (const register of Object.values(
|
|
5356
5392
|
proj.events
|
|
5357
5393
|
))
|