@rotorsoft/act 1.23.30 → 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 +9 -1
- package/dist/@types/internal/drain-cycle.d.ts.map +1 -1
- package/dist/index.cjs +24 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -22
- 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,
|
|
@@ -2477,7 +2490,7 @@ function trace_cycle(logger, leased, fetched, handled, acked, blocked) {
|
|
|
2477
2490
|
}
|
|
2478
2491
|
|
|
2479
2492
|
// src/internal/drain-cycle.ts
|
|
2480
|
-
async function run_drain_cycle(ops, registry, batch_handlers, handle, handle_batch, lagging, leading, eventLimit, leaseMillis, lane) {
|
|
2493
|
+
async function run_drain_cycle(ops, registry, batch_handlers, handle, handle_batch, lagging, leading, eventLimit, leaseMillis, on_blocked, lane) {
|
|
2481
2494
|
const leased = await ops.claim(
|
|
2482
2495
|
lagging,
|
|
2483
2496
|
leading,
|
|
@@ -2519,6 +2532,7 @@ async function run_drain_cycle(ops, registry, batch_handlers, handle, handle_bat
|
|
|
2519
2532
|
const blocked = await ops.block(
|
|
2520
2533
|
handled.filter(({ block: block2 }) => block2).map(({ lease, error }) => ({ ...lease, error }))
|
|
2521
2534
|
);
|
|
2535
|
+
if (blocked.length) on_blocked(blocked);
|
|
2522
2536
|
const acked = await ops.ack(
|
|
2523
2537
|
handled.flatMap((h, i) => {
|
|
2524
2538
|
const advance = h.handled > 0 ? h.acked_at : leased[i].at;
|
|
@@ -2541,13 +2555,6 @@ var contain = (logger, sink, fn) => {
|
|
|
2541
2555
|
logger.error(error, `${sink} listener threw`);
|
|
2542
2556
|
}
|
|
2543
2557
|
};
|
|
2544
|
-
var contain_async = async (logger, sink, fn) => {
|
|
2545
|
-
try {
|
|
2546
|
-
await fn();
|
|
2547
|
-
} catch (error) {
|
|
2548
|
-
logger.error(error, `${sink} listener threw`);
|
|
2549
|
-
}
|
|
2550
|
-
};
|
|
2551
2558
|
var DrainController = class {
|
|
2552
2559
|
_armed = false;
|
|
2553
2560
|
_locked = false;
|
|
@@ -2656,10 +2663,11 @@ var DrainController = class {
|
|
|
2656
2663
|
leading,
|
|
2657
2664
|
eventLimit,
|
|
2658
2665
|
leaseMillis,
|
|
2666
|
+
(b) => contain(this._deps.logger, "blocked", () => this._deps.on_blocked(b)),
|
|
2659
2667
|
this._deps.lane
|
|
2660
2668
|
);
|
|
2661
|
-
this._deps.breaker.passed();
|
|
2662
2669
|
if (!cycle) {
|
|
2670
|
+
this._deps.breaker.passed();
|
|
2663
2671
|
this._armed = false;
|
|
2664
2672
|
return EMPTY_DRAIN;
|
|
2665
2673
|
}
|
|
@@ -2675,18 +2683,8 @@ var DrainController = class {
|
|
|
2675
2683
|
if (this._defer.size > 0) this._defer.schedule();
|
|
2676
2684
|
if (acked.length)
|
|
2677
2685
|
contain(this._deps.logger, "acked", () => this._deps.on_acked(acked));
|
|
2678
|
-
if (
|
|
2679
|
-
|
|
2680
|
-
this._deps.logger,
|
|
2681
|
-
"blocked",
|
|
2682
|
-
() => this._deps.on_blocked(blocked)
|
|
2683
|
-
);
|
|
2684
|
-
if (closeable.length)
|
|
2685
|
-
await contain_async(
|
|
2686
|
-
this._deps.logger,
|
|
2687
|
-
"close",
|
|
2688
|
-
() => this._deps.on_close(closeable)
|
|
2689
|
-
);
|
|
2686
|
+
if (closeable.length) await this._deps.on_close(closeable);
|
|
2687
|
+
this._deps.breaker.passed();
|
|
2690
2688
|
const has_errors = handled.some(({ error }) => error);
|
|
2691
2689
|
if (!acked.length && !blocked.length && !has_errors) this._armed = false;
|
|
2692
2690
|
return { fetched, leased, acked, blocked };
|
|
@@ -3278,7 +3276,11 @@ var Act = class {
|
|
|
3278
3276
|
correlation: close_correlation(this._correlator, close_actor),
|
|
3279
3277
|
with_stream_lock: (stream, work) => this._with_close_lock(stream, work)
|
|
3280
3278
|
});
|
|
3281
|
-
|
|
3279
|
+
try {
|
|
3280
|
+
this.emit("closed", result);
|
|
3281
|
+
} catch (err) {
|
|
3282
|
+
this._logger.error(err, "closed listener threw");
|
|
3283
|
+
}
|
|
3282
3284
|
},
|
|
3283
3285
|
breaker: this._breaker,
|
|
3284
3286
|
// Re-scope the per-lane worker's auto-start ticks so their drain
|