@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.
package/build/package.json
CHANGED
|
@@ -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
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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, {
|