@rotorsoft/act 1.32.8 → 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/dist/index.js
CHANGED
|
@@ -2849,6 +2849,16 @@ function budget_exhausted(lease, options, store_failing) {
|
|
|
2849
2849
|
log().error(error);
|
|
2850
2850
|
return { lease, handled: 0, acked_at: lease.at, error, block: true };
|
|
2851
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
|
+
}
|
|
2852
2862
|
function warn_misrouted(seen, stream, handler, event) {
|
|
2853
2863
|
report_once(
|
|
2854
2864
|
seen,
|
|
@@ -2899,11 +2909,14 @@ async function run_drain_cycle(ops, registry, batch_handlers, misrouted, store_f
|
|
|
2899
2909
|
if (entry.fetch.error !== void 0) {
|
|
2900
2910
|
const error = `Fetch failed for ${lease.stream}: ${entry.fetch.error}`;
|
|
2901
2911
|
log().error(error);
|
|
2912
|
+
const policy = fetch_failure_policy(registry);
|
|
2913
|
+
const block2 = !store_failing && policy.blockOnError && lease.retry >= policy.maxRetries;
|
|
2902
2914
|
const failed = {
|
|
2903
2915
|
lease,
|
|
2904
2916
|
handled: 0,
|
|
2905
2917
|
acked_at: lease.at,
|
|
2906
|
-
error
|
|
2918
|
+
error,
|
|
2919
|
+
...block2 ? { block: true } : {}
|
|
2907
2920
|
};
|
|
2908
2921
|
return Promise.resolve(failed);
|
|
2909
2922
|
}
|
|
@@ -5374,6 +5387,7 @@ function act() {
|
|
|
5374
5387
|
const pending_projections = [];
|
|
5375
5388
|
const projection_reactions = /* @__PURE__ */ new Set();
|
|
5376
5389
|
const record_projection_reactions = (proj) => {
|
|
5390
|
+
if (!proj.batchHandler && !proj.fold) return;
|
|
5377
5391
|
for (const register of Object.values(
|
|
5378
5392
|
proj.events
|
|
5379
5393
|
))
|