@rotorsoft/act 1.23.31 → 1.23.32
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/close-cycle.d.ts.map +1 -1
- package/dist/@types/internal/drain-cycle.d.ts.map +1 -1
- package/dist/index.cjs +21 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +21 -15
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1311,6 +1311,19 @@ async function run_close_cycle(targets, deps) {
|
|
|
1311
1311
|
if (!full.length) return { truncated: windowed_result, skipped };
|
|
1312
1312
|
const streams = full.map((t) => t.stream);
|
|
1313
1313
|
const stream_info = await scan_stream_heads(streams);
|
|
1314
|
+
for (const target of full) {
|
|
1315
|
+
if (!target.restart) continue;
|
|
1316
|
+
const info = stream_info.get(target.stream);
|
|
1317
|
+
if (!info) continue;
|
|
1318
|
+
const owner = deps.event_to_state.get(info.last_event_name);
|
|
1319
|
+
if (owner?.pii_aware) {
|
|
1320
|
+
deps.logger.error(
|
|
1321
|
+
`Refusing to close "${target.stream}" with restart: state "${owner.name}" carries sensitive fields, so a restart seed would persist redacted values while deleting the originals. Close it without restart to retire the stream, or leave it open.`
|
|
1322
|
+
);
|
|
1323
|
+
skipped.push(target.stream);
|
|
1324
|
+
stream_info.delete(target.stream);
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1314
1327
|
const safe = await partition_by_safety(
|
|
1315
1328
|
stream_info,
|
|
1316
1329
|
deps.reactive_events_size,
|
|
@@ -2542,13 +2555,6 @@ var contain = (logger, sink, fn) => {
|
|
|
2542
2555
|
logger.error(error, `${sink} listener threw`);
|
|
2543
2556
|
}
|
|
2544
2557
|
};
|
|
2545
|
-
var contain_async = async (logger, sink, fn) => {
|
|
2546
|
-
try {
|
|
2547
|
-
await fn();
|
|
2548
|
-
} catch (error) {
|
|
2549
|
-
logger.error(error, `${sink} listener threw`);
|
|
2550
|
-
}
|
|
2551
|
-
};
|
|
2552
2558
|
var DrainController = class {
|
|
2553
2559
|
_armed = false;
|
|
2554
2560
|
_locked = false;
|
|
@@ -2660,8 +2666,8 @@ var DrainController = class {
|
|
|
2660
2666
|
(b) => contain(this._deps.logger, "blocked", () => this._deps.on_blocked(b)),
|
|
2661
2667
|
this._deps.lane
|
|
2662
2668
|
);
|
|
2663
|
-
this._deps.breaker.passed();
|
|
2664
2669
|
if (!cycle) {
|
|
2670
|
+
this._deps.breaker.passed();
|
|
2665
2671
|
this._armed = false;
|
|
2666
2672
|
return EMPTY_DRAIN;
|
|
2667
2673
|
}
|
|
@@ -2677,12 +2683,8 @@ var DrainController = class {
|
|
|
2677
2683
|
if (this._defer.size > 0) this._defer.schedule();
|
|
2678
2684
|
if (acked.length)
|
|
2679
2685
|
contain(this._deps.logger, "acked", () => this._deps.on_acked(acked));
|
|
2680
|
-
if (closeable.length)
|
|
2681
|
-
|
|
2682
|
-
this._deps.logger,
|
|
2683
|
-
"close",
|
|
2684
|
-
() => this._deps.on_close(closeable)
|
|
2685
|
-
);
|
|
2686
|
+
if (closeable.length) await this._deps.on_close(closeable);
|
|
2687
|
+
this._deps.breaker.passed();
|
|
2686
2688
|
const has_errors = handled.some(({ error }) => error);
|
|
2687
2689
|
if (!acked.length && !blocked.length && !has_errors) this._armed = false;
|
|
2688
2690
|
return { fetched, leased, acked, blocked };
|
|
@@ -3274,7 +3276,11 @@ var Act = class {
|
|
|
3274
3276
|
correlation: close_correlation(this._correlator, close_actor),
|
|
3275
3277
|
with_stream_lock: (stream, work) => this._with_close_lock(stream, work)
|
|
3276
3278
|
});
|
|
3277
|
-
|
|
3279
|
+
try {
|
|
3280
|
+
this.emit("closed", result);
|
|
3281
|
+
} catch (err) {
|
|
3282
|
+
this._logger.error(err, "closed listener threw");
|
|
3283
|
+
}
|
|
3278
3284
|
},
|
|
3279
3285
|
breaker: this._breaker,
|
|
3280
3286
|
// Re-scope the per-lane worker's auto-start ticks so their drain
|