@hotmeshio/hotmesh 0.22.6 → 0.22.7

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotmeshio/hotmesh",
3
- "version": "0.22.6",
3
+ "version": "0.22.7",
4
4
  "description": "Durable Workflow",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -49,10 +49,21 @@ async function getVID(instance, vid) {
49
49
  }
50
50
  return { id: instance.appId, version: app.version };
51
51
  }
52
- else if (!instance.apps && vid) {
53
- instance.apps = {};
54
- instance.apps[instance.appId] = vid;
55
- return vid;
52
+ else if (!instance.apps) {
53
+ // First call — always DB-refresh to avoid locking in a stale version.
54
+ // The `vid` parameter originates from store.getApp() (which may be
55
+ // cached from before the last activation). If a worker missed the
56
+ // nocache NOTIFY (startup race: LISTEN not yet established when the
57
+ // NOTIFY fired), it would lock in the pre-activation version for its
58
+ // entire lifetime, silently loading the old schema on every request.
59
+ // One extra DB query here, once per engine lifetime, eliminates the
60
+ // race regardless of NOTIFY delivery.
61
+ const id = vid?.id ?? instance.appId;
62
+ const freshApp = await instance.store.getApp(id, true);
63
+ if (!instance.apps)
64
+ instance.apps = {};
65
+ instance.apps[instance.appId] = freshApp;
66
+ return { id: freshApp.id, version: freshApp.version };
56
67
  }
57
68
  else {
58
69
  return await fetchAndVerifyVID(instance, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotmeshio/hotmesh",
3
- "version": "0.22.6",
3
+ "version": "0.22.7",
4
4
  "description": "Durable Workflow",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",