@rotorsoft/act 1.23.17 → 1.23.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/dist/.tsbuildinfo +1 -1
- package/dist/@types/act.d.ts.map +1 -1
- package/dist/@types/internal/autoclose-reaction.d.ts.map +1 -1
- package/dist/@types/internal/correlate-cycle.d.ts +7 -0
- package/dist/@types/internal/correlate-cycle.d.ts.map +1 -1
- package/dist/@types/internal/settle.d.ts +10 -0
- package/dist/@types/internal/settle.d.ts.map +1 -1
- package/dist/index.cjs +26 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -13
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -755,10 +755,9 @@ function synthesize_autoclose_reactions(registry, states, config2) {
|
|
|
755
755
|
dues.push(days_after(head.created, after_days));
|
|
756
756
|
if (keep_days !== void 0)
|
|
757
757
|
dues.push(days_after(entry.tail.created, keep_days));
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
});
|
|
758
|
+
const future = dues.map((d) => d.getTime()).filter((t) => t > Date.now());
|
|
759
|
+
if (future.length)
|
|
760
|
+
throw new DeferSignal({ at: new Date(Math.min(...future)) });
|
|
762
761
|
}
|
|
763
762
|
};
|
|
764
763
|
const key = `__autoclose_${st.name}`;
|
|
@@ -1567,6 +1566,15 @@ var CorrelateCycle = class {
|
|
|
1567
1566
|
get checkpoint() {
|
|
1568
1567
|
return this._checkpoint;
|
|
1569
1568
|
}
|
|
1569
|
+
/**
|
|
1570
|
+
* Whether any reaction uses a dynamic resolver — i.e. whether `correlate`
|
|
1571
|
+
* performs a store scan rather than the static no-op early-return. The
|
|
1572
|
+
* settle loop reads this to avoid recording a fictitious circuit-breaker
|
|
1573
|
+
* success on a static app whose correlate never touches the store (#1329).
|
|
1574
|
+
*/
|
|
1575
|
+
get has_dynamic_resolvers() {
|
|
1576
|
+
return this._has_dynamic_resolvers;
|
|
1577
|
+
}
|
|
1570
1578
|
/**
|
|
1571
1579
|
* Initialize correlation state on first call.
|
|
1572
1580
|
* - Reads max(at) from store, then floors the cold-start checkpoint at
|
|
@@ -2861,7 +2869,7 @@ var SettleLoop = class {
|
|
|
2861
2869
|
...correlate_query,
|
|
2862
2870
|
after: after_before
|
|
2863
2871
|
});
|
|
2864
|
-
this._deps.breaker.passed();
|
|
2872
|
+
if (this._deps.correlate_probes_store) this._deps.breaker.passed();
|
|
2865
2873
|
last_drain = await this._deps.drain(drain_options);
|
|
2866
2874
|
const made_progress = subscribed > 0 || last_drain.acked.length > 0 || last_drain.blocked.length > 0 || last_id > after_before;
|
|
2867
2875
|
if (!made_progress) break;
|
|
@@ -3126,13 +3134,14 @@ var Act = class {
|
|
|
3126
3134
|
on_error: (error, circuit) => this._emit_error(error, circuit),
|
|
3127
3135
|
// Re-probe the store when the cooldown elapses, so recovery is
|
|
3128
3136
|
// automatic even on the default lane (which has no periodic poller).
|
|
3129
|
-
//
|
|
3130
|
-
//
|
|
3131
|
-
//
|
|
3132
|
-
//
|
|
3133
|
-
//
|
|
3134
|
-
//
|
|
3135
|
-
// the breaker
|
|
3137
|
+
// The wake fires `settle()`, which (in half-open) runs a real store
|
|
3138
|
+
// probe: for a dynamic-resolver app the probe is settle's correlate
|
|
3139
|
+
// (a store scan); for a static-reaction app correlate is a no-op that
|
|
3140
|
+
// records no health, so the probe is settle's DRAIN claim — either
|
|
3141
|
+
// way one success closes the breaker and every loop resumes, a
|
|
3142
|
+
// failure re-opens it and reschedules the wake. Settle does NOT close
|
|
3143
|
+
// the breaker off a no-op correlate (#1329) — only a real store op
|
|
3144
|
+
// (correlate scan or drain claim) records `passed()`.
|
|
3136
3145
|
on_retry: () => {
|
|
3137
3146
|
this.settle({ debounceMs: 0 });
|
|
3138
3147
|
}
|
|
@@ -3309,7 +3318,11 @@ var Act = class {
|
|
|
3309
3318
|
correlate: (q) => this.correlate(q),
|
|
3310
3319
|
drain: (o) => this.drain(o),
|
|
3311
3320
|
on_settled: (drain) => this.emit("settled", drain),
|
|
3312
|
-
breaker: this._breaker
|
|
3321
|
+
breaker: this._breaker,
|
|
3322
|
+
// Static-reaction apps' correlate is a no-op (no store call), so a
|
|
3323
|
+
// settle pass carries no store-health signal — don't let it record a
|
|
3324
|
+
// breaker success (#1329).
|
|
3325
|
+
correlate_probes_store: this._correlate.has_dynamic_resolvers
|
|
3313
3326
|
},
|
|
3314
3327
|
options.settleDebounceMs ?? DEFAULT_SETTLE_DEBOUNCE_MS
|
|
3315
3328
|
);
|