@rotorsoft/act 0.43.0 → 0.44.0

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
@@ -18,7 +18,7 @@ import {
18
18
  sleep,
19
19
  store,
20
20
  validate
21
- } from "./chunk-QAB4SDOS.js";
21
+ } from "./chunk-LKRNWD7C.js";
22
22
  import {
23
23
  ActorSchema,
24
24
  CausationEventSchema,
@@ -133,24 +133,18 @@ async function runCloseCycle(targets, deps) {
133
133
  return { truncated, skipped };
134
134
  }
135
135
  async function scanStreamHeads(streams) {
136
+ const stats = await store().query_stats(streams, {
137
+ exclude: [SNAP_EVENT]
138
+ });
136
139
  const out = /* @__PURE__ */ new Map();
137
- await Promise.all(
138
- streams.map(async (s) => {
139
- let maxId = -1;
140
- let version = -1;
141
- let lastEventName = "";
142
- await store().query(
143
- (e) => {
144
- if (e.name === TOMBSTONE_EVENT || maxId !== -1) return;
145
- maxId = e.id;
146
- version = e.version;
147
- lastEventName = e.name;
148
- },
149
- { stream: s, stream_exact: true, backward: true, limit: 1 }
150
- );
151
- if (maxId >= 0) out.set(s, { maxId, version, lastEventName });
152
- })
153
- );
140
+ for (const [stream, { head }] of stats) {
141
+ if (head.name === TOMBSTONE_EVENT) continue;
142
+ out.set(stream, {
143
+ maxId: head.id,
144
+ version: head.version,
145
+ lastEventName: head.name
146
+ });
147
+ }
154
148
  return out;
155
149
  }
156
150
  async function partitionBySafety(streamInfo, reactiveEventsSize, skipped) {