@rotorsoft/act 1.32.7 → 1.32.8

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
@@ -26,7 +26,7 @@ import {
26
26
  sleep,
27
27
  store,
28
28
  validate
29
- } from "./chunk-7OAW4YMO.js";
29
+ } from "./chunk-F4F5AKM3.js";
30
30
  import {
31
31
  ActorSchema,
32
32
  CausationEventSchema,
@@ -1742,6 +1742,24 @@ var CorrelateCycle = class {
1742
1742
  * `_static_subscriptions`, which this never touches, so they stay pinned
1743
1743
  * at +Infinity and the dynamic path never re-opens them.
1744
1744
  */
1745
+ /**
1746
+ * Start correlation over after the event log was replaced wholesale
1747
+ * (`restore`). The restored log is renumbered from the start and its
1748
+ * subscription rows are gone, so the in-memory scan position and both
1749
+ * subscription records describe a log that no longer exists. Dropping them
1750
+ * and the init latch makes the next pass run cold-start again: static
1751
+ * targets are re-subscribed, the checkpoint is re-read from the store
1752
+ * (which `restore` reset), and dynamic targets are rediscovered by the
1753
+ * scan (#1772).
1754
+ */
1755
+ restart() {
1756
+ this._initialized = false;
1757
+ this._init_promise = void 0;
1758
+ this._checkpoint = -1;
1759
+ this._dynamic_subscriptions.clear();
1760
+ this._static_subscriptions.clear();
1761
+ this._armed = true;
1762
+ }
1745
1763
  forget_subscribed(streams) {
1746
1764
  for (const stream of streams) this._dynamic_subscriptions.delete(stream);
1747
1765
  }
@@ -4683,6 +4701,10 @@ var Act = class {
4683
4701
  migrated = partial.migrated;
4684
4702
  dropped = partial.dropped;
4685
4703
  });
4704
+ if (!sink) {
4705
+ this._correlate.restart();
4706
+ this._arm_all();
4707
+ }
4686
4708
  return { kept, migrated, dropped, duration_ms: Date.now() - started };
4687
4709
  });
4688
4710
  }