@rotorsoft/act 1.23.3 → 1.23.5

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
@@ -20,7 +20,7 @@ import {
20
20
  sleep,
21
21
  store,
22
22
  validate
23
- } from "./chunk-5YIRFU4Y.js";
23
+ } from "./chunk-DORIRU2I.js";
24
24
  import {
25
25
  ActorSchema,
26
26
  CausationEventSchema,
@@ -2300,7 +2300,7 @@ function trace_cycle(logger, leased, fetched, handled, acked, blocked) {
2300
2300
  }
2301
2301
 
2302
2302
  // src/internal/drain-cycle.ts
2303
- async function run_drain_cycle(ops, registry, batch_handlers, handle, handle_batch, lagging, leading, eventLimit, leaseMillis, is_deferred, lane) {
2303
+ async function run_drain_cycle(ops, registry, batch_handlers, handle, handle_batch, lagging, leading, eventLimit, leaseMillis, lane) {
2304
2304
  const leased = await ops.claim(
2305
2305
  lagging,
2306
2306
  leading,
@@ -2309,18 +2309,7 @@ async function run_drain_cycle(ops, registry, batch_handlers, handle, handle_bat
2309
2309
  lane
2310
2310
  );
2311
2311
  if (!leased.length) return void 0;
2312
- const active = is_deferred ? leased.filter((l) => !is_deferred(l.stream)) : leased;
2313
- if (!active.length) {
2314
- return {
2315
- leased,
2316
- fetched: [],
2317
- handled: [],
2318
- acked: [],
2319
- blocked: [],
2320
- closeable: []
2321
- };
2322
- }
2323
- const fetched = await ops.fetch(active, eventLimit);
2312
+ const fetched = await ops.fetch(leased, eventLimit);
2324
2313
  const fetch_map = /* @__PURE__ */ new Map();
2325
2314
  const fetch_window_at = fetched.reduce(
2326
2315
  (max, { at, events }) => Math.max(max, events.at(-1)?.id || at),
@@ -2339,7 +2328,7 @@ async function run_drain_cycle(ops, registry, batch_handlers, handle, handle_bat
2339
2328
  fetch_map.set(stream, { fetch: f, payloads });
2340
2329
  }
2341
2330
  const handled = await Promise.all(
2342
- active.map((lease) => {
2331
+ leased.map((lease) => {
2343
2332
  const entry = fetch_map.get(lease.stream);
2344
2333
  const at = entry.fetch.events.at(-1)?.id || fetch_window_at;
2345
2334
  const { payloads } = entry;
@@ -2352,7 +2341,7 @@ async function run_drain_cycle(ops, registry, batch_handlers, handle, handle_bat
2352
2341
  );
2353
2342
  const acked = await ops.ack(
2354
2343
  handled.flatMap(
2355
- (h) => h.defer !== void 0 ? { ...h.lease, due: h.defer } : h.handled > 0 || !h.error ? { ...h.lease, at: h.acked_at } : []
2344
+ (h) => h.defer !== void 0 ? { ...h.lease, due: h.defer, retry: -1 } : h.handled > 0 || !h.error ? { ...h.lease, at: h.acked_at } : h.next_attempt_at !== void 0 ? { ...h.lease, due: h.next_attempt_at } : []
2356
2345
  )
2357
2346
  );
2358
2347
  const blocked = await ops.block(
@@ -2475,7 +2464,6 @@ var DrainController = class {
2475
2464
  leading,
2476
2465
  eventLimit,
2477
2466
  leaseMillis,
2478
- this._defer.size > 0 ? this._defer.is_deferred : void 0,
2479
2467
  this._deps.lane
2480
2468
  );
2481
2469
  this._deps.breaker.passed();