@rotorsoft/act 0.22.0 → 0.23.1

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
@@ -401,7 +401,11 @@ var InMemoryStore = class {
401
401
  */
402
402
  async claim(lagging, leading, by, millis) {
403
403
  await sleep();
404
- const available = [...this._streams.values()].filter((s) => s.is_avaliable);
404
+ const available = [...this._streams.values()].filter(
405
+ (s) => s.is_avaliable && (s.at < 0 || this._events.some(
406
+ (e) => e.id > s.at && e.name !== SNAP_EVENT && (!s.source || RegExp(s.source).test(e.stream))
407
+ ))
408
+ );
405
409
  const lag = available.sort((a, b) => a.at - b.at).slice(0, lagging).map((s) => ({
406
410
  stream: s.stream,
407
411
  source: s.source,
@@ -1237,13 +1241,13 @@ var Act = class {
1237
1241
  },
1238
1242
  { ...query, after }
1239
1243
  );
1240
- this._correlation_checkpoint = last_id;
1241
1244
  if (correlated.size) {
1242
1245
  const streams = [...correlated.entries()].map(([stream, { source }]) => ({
1243
1246
  stream,
1244
1247
  source
1245
1248
  }));
1246
1249
  const { subscribed } = await store().subscribe(streams);
1250
+ this._correlation_checkpoint = last_id;
1247
1251
  if (subscribed) {
1248
1252
  tracer.correlated(streams);
1249
1253
  for (const { stream } of streams) {
@@ -1252,6 +1256,7 @@ var Act = class {
1252
1256
  }
1253
1257
  return { subscribed, last_id };
1254
1258
  }
1259
+ this._correlation_checkpoint = last_id;
1255
1260
  return { subscribed: 0, last_id };
1256
1261
  }
1257
1262
  /**