@rotorsoft/act 1.31.9 → 1.31.11

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
@@ -95,11 +95,12 @@ function classify_registry(registry, states) {
95
95
  set.add(lane_name);
96
96
  event_to_lanes.set(name, set);
97
97
  }
98
- if (!target_lanes.has(target)) {
99
- target_lanes.set(target, lane);
100
- } else if ((target_lanes.get(target) ?? void 0) !== (lane ?? void 0)) {
98
+ const recorded_lane = target_lanes.get(target);
99
+ if (recorded_lane === void 0) {
100
+ target_lanes.set(target, lane_name);
101
+ } else if (recorded_lane !== lane_name) {
101
102
  throw new Error(
102
- `Stream "${target}" has conflicting lane assignments ("${target_lanes.get(target) ?? "default"}" vs "${lane ?? "default"}")`
103
+ `Stream "${target}" has conflicting lane assignments ("${recorded_lane}" vs "${lane_name}")`
103
104
  );
104
105
  }
105
106
  const key = `${target}|${source ?? ""}`;
@@ -2243,7 +2244,12 @@ async function load(me, target, callback, patch_fn = bare_patch) {
2243
2244
  event_id: event.id,
2244
2245
  patches,
2245
2246
  snaps
2246
- }).catch((err) => log().error(err));
2247
+ }).catch(
2248
+ (err) => log().warn(
2249
+ err,
2250
+ "cache set skipped; the next load re-folds from the store"
2251
+ )
2252
+ );
2247
2253
  }
2248
2254
  return {
2249
2255
  event,
@@ -2342,7 +2348,12 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
2342
2348
  );
2343
2349
  } catch (error) {
2344
2350
  if (error instanceof ConcurrencyError) {
2345
- cache().invalidate(stream).catch((err) => log().error(err));
2351
+ cache().invalidate(stream).catch(
2352
+ (err) => log().warn(
2353
+ err,
2354
+ "cache invalidate skipped; a stale checkpoint re-folds from its event_id"
2355
+ )
2356
+ );
2346
2357
  }
2347
2358
  throw error;
2348
2359
  }
@@ -2377,9 +2388,19 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
2377
2388
  event_id: snap_event?.id ?? last.event.id,
2378
2389
  patches: snap_event ? 0 : last.patches,
2379
2390
  snaps: snap_event ? last.snaps + 1 : last.snaps
2380
- }).catch((err) => log().error(err));
2391
+ }).catch(
2392
+ (err) => log().warn(
2393
+ err,
2394
+ "cache set skipped; the next load re-folds from the store"
2395
+ )
2396
+ );
2381
2397
  else
2382
- cache().invalidate(stream).catch((err) => log().error(err));
2398
+ cache().invalidate(stream).catch(
2399
+ (err) => log().warn(
2400
+ err,
2401
+ "cache invalidate skipped; a stale checkpoint re-folds from its event_id"
2402
+ )
2403
+ );
2383
2404
  }
2384
2405
  return snapshots;
2385
2406
  } catch (error) {
@@ -2653,10 +2674,8 @@ async function run_drain_cycle(ops, registry, batch_handlers, misrouted, handle,
2653
2674
  const acked = await ops.ack(submitted);
2654
2675
  const expected = submitted.filter((l) => l.due === void 0).length;
2655
2676
  if (acked.length < expected)
2656
- log().error(
2657
- new Error(
2658
- `drain: ${expected - acked.length} of ${expected} acks were dropped \u2014 the lease was taken by another worker mid-handler. That work will be redelivered (at-least-once), but persistent drops mean leaseMillis is too short for this handler.`
2659
- )
2677
+ log().warn(
2678
+ `drain: ${expected - acked.length} of ${expected} acks were dropped \u2014 the lease was taken by another worker mid-handler. That work will be redelivered (at-least-once), but persistent drops mean leaseMillis is too short for this handler.`
2660
2679
  );
2661
2680
  const closeable = handled.filter((h) => h.close !== void 0).map((h) => h.close);
2662
2681
  return { leased, fetched, handled, acked, blocked, closeable };