@rotorsoft/act 1.23.29 → 1.23.31

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
@@ -2477,7 +2477,7 @@ function trace_cycle(logger, leased, fetched, handled, acked, blocked) {
2477
2477
  }
2478
2478
 
2479
2479
  // src/internal/drain-cycle.ts
2480
- async function run_drain_cycle(ops, registry, batch_handlers, handle, handle_batch, lagging, leading, eventLimit, leaseMillis, lane) {
2480
+ async function run_drain_cycle(ops, registry, batch_handlers, handle, handle_batch, lagging, leading, eventLimit, leaseMillis, on_blocked, lane) {
2481
2481
  const leased = await ops.claim(
2482
2482
  lagging,
2483
2483
  leading,
@@ -2519,6 +2519,7 @@ async function run_drain_cycle(ops, registry, batch_handlers, handle, handle_bat
2519
2519
  const blocked = await ops.block(
2520
2520
  handled.filter(({ block: block2 }) => block2).map(({ lease, error }) => ({ ...lease, error }))
2521
2521
  );
2522
+ if (blocked.length) on_blocked(blocked);
2522
2523
  const acked = await ops.ack(
2523
2524
  handled.flatMap((h, i) => {
2524
2525
  const advance = h.handled > 0 ? h.acked_at : leased[i].at;
@@ -2656,6 +2657,7 @@ var DrainController = class {
2656
2657
  leading,
2657
2658
  eventLimit,
2658
2659
  leaseMillis,
2660
+ (b) => contain(this._deps.logger, "blocked", () => this._deps.on_blocked(b)),
2659
2661
  this._deps.lane
2660
2662
  );
2661
2663
  this._deps.breaker.passed();
@@ -2675,12 +2677,6 @@ var DrainController = class {
2675
2677
  if (this._defer.size > 0) this._defer.schedule();
2676
2678
  if (acked.length)
2677
2679
  contain(this._deps.logger, "acked", () => this._deps.on_acked(acked));
2678
- if (blocked.length)
2679
- contain(
2680
- this._deps.logger,
2681
- "blocked",
2682
- () => this._deps.on_blocked(blocked)
2683
- );
2684
2680
  if (closeable.length)
2685
2681
  await contain_async(
2686
2682
  this._deps.logger,
@@ -4905,11 +4901,15 @@ var CsvFile = class {
4905
4901
  const event = {
4906
4902
  id: Number.parseInt(fields[0], 10),
4907
4903
  name: fields[1],
4908
- data: JSON.parse(fields[2]),
4904
+ // Revive dates like every Store adapter does — a Date in an event
4905
+ // payload must not depend on whether it came back through a store or
4906
+ // through a CSV restore (#1399). The `created` column below has
4907
+ // always been parsed explicitly; the JSON columns were missed.
4908
+ data: JSON.parse(fields[2], dateReviver),
4909
4909
  stream: fields[3],
4910
4910
  version: Number.parseInt(fields[4], 10),
4911
4911
  created: new Date(fields[5]),
4912
- meta: JSON.parse(fields[6])
4912
+ meta: JSON.parse(fields[6], dateReviver)
4913
4913
  };
4914
4914
  await Promise.resolve(callback(event));
4915
4915
  count++;