@rotorsoft/act 1.33.19 → 1.33.20

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
@@ -2343,15 +2343,14 @@ async function run_drain_cycle(deps, cycle) {
2343
2343
  return handle({ ...lease, at }, payloads);
2344
2344
  })
2345
2345
  );
2346
- const blocked = await ops.block(
2347
- handled.filter(({ block: block2 }) => block2).map(({ lease, error }) => ({ ...lease, error }))
2348
- );
2346
+ const to_block = handled.filter(({ block: block2 }) => block2).map(({ lease, error }) => ({ ...lease, error }));
2347
+ const blocked = to_block.length ? await ops.block(to_block) : [];
2349
2348
  if (blocked.length) deps.on_blocked(blocked);
2350
2349
  const submitted = handled.flatMap((h, i) => {
2351
2350
  const advance = h.handled > 0 ? h.acked_at : leased[i].at;
2352
2351
  return h.defer !== void 0 ? { ...h.lease, at: advance, due: h.defer, retry: -1 } : h.next_attempt_at !== void 0 ? { ...h.lease, at: advance, due: h.next_attempt_at } : h.handled > 0 || !h.error ? { ...h.lease, at: h.acked_at } : [];
2353
2352
  });
2354
- const acked = await ops.ack(submitted);
2353
+ const acked = submitted.length ? await ops.ack(submitted) : [];
2355
2354
  const expected = submitted.filter((l) => l.due === void 0).length;
2356
2355
  if (acked.length < expected)
2357
2356
  log().warn(
@@ -2854,9 +2853,8 @@ var SettleLoop = class {
2854
2853
  * `debounceMs` brings it forward), and a call during a running cycle
2855
2854
  * queues one more pass after it. Callers pass options, which the next
2856
2855
  * pass uses; internal wake-ups pass none, so they never discard a
2857
- * caller's. The cycle runs correlate→drain in a
2858
- * loop until a pass makes no progress (it read no events and leased no
2859
- * streams) or `maxPasses` is reached, then emits the
2856
+ * caller's. The cycle runs correlate→drain passes until one makes no
2857
+ * progress (see {@link SettleOptions.maxPasses}), then emits the
2860
2858
  * `"settled"` lifecycle event via {@link SettleDeps.on_settled}.
2861
2859
  */
2862
2860
  schedule(options) {
@@ -3906,8 +3904,8 @@ var Act = class {
3906
3904
  * `unblock()`, `restore()`) schedules this on its own unless the app
3907
3905
  * sets `autoSettle: false`. Call it at startup, to run what was pending
3908
3906
  * before a restart, or with options for the next pass; the scheduling
3909
- * rule is in the event-sourcing docs (§ settle). Runs correlate→drain in a loop until a pass makes no
3910
- * progress — it read no events and leased no streams —
3907
+ * rule is in the event-sourcing docs (§ settle). Runs correlate→drain
3908
+ * passes until one makes no progress (see {@link SettleOptions.maxPasses}),
3911
3909
  * then emits the `"settled"` lifecycle event, so one call fully catches
3912
3910
  * up paginated streams without forcing callers to loop.
3913
3911
  *