veryfront 0.1.789 → 0.1.790
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/esm/deno.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest-cache.d.ts","sourceRoot":"","sources":["../../../src/src/release-assets/manifest-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAOH,OAAO,EAA6B,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"manifest-cache.d.ts","sourceRoot":"","sources":["../../../src/src/release-assets/manifest-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAOH,OAAO,EAA6B,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAkC5F;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAC1B;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAChE,CAAC;CACH;AAKD;;;;;;GAMG;AACH,wBAAgB,iCAAiC,CAC/C,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,2BAA2B,GACnC,IAAI,CAEN;AAED;;;;GAIG;AACH,wBAAgB,mCAAmC,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAE3E;AAED;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAClD,OAAO,EAAE,2BAA2B,GAAG,SAAS,GAC/C,IAAI,CAMN;AASD,yEAAyE;AACzE,wBAAgB,6BAA6B,IAAI,OAAO,CAKvD;AAOD;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACnC,oBAAoB,GAAG,IAAI,CAoC7B;AA2DD,6EAA6E;AAC7E,wBAAgB,gCAAgC,IAAI,IAAI,CAIvD;AAED,uEAAuE;AACvE,wBAAgB,8BAA8B,IAAI,IAAI,CAGrD"}
|
|
@@ -35,6 +35,8 @@ const MAX_CACHED_MANIFESTS = 500;
|
|
|
35
35
|
const NON_READY_TTL_MS = 30_000;
|
|
36
36
|
/** TTL for ready manifests — long but finite so superseded entries are picked up (15 min). */
|
|
37
37
|
const READY_TTL_MS = 15 * 60 * 1000;
|
|
38
|
+
/** Background revalidation interval for ready manifests (1 min). */
|
|
39
|
+
const READY_REVALIDATE_MS = 60_000;
|
|
38
40
|
const manifestCache = new LRUCache({ maxEntries: MAX_CACHED_MANIFESTS });
|
|
39
41
|
registerLRUCache("release-asset-manifest-cache", manifestCache);
|
|
40
42
|
/** In-flight fetches, deduped per releaseId. */
|
|
@@ -119,8 +121,12 @@ export function getReadyManifestForRender(releaseId) {
|
|
|
119
121
|
}
|
|
120
122
|
}
|
|
121
123
|
}
|
|
122
|
-
if (best)
|
|
124
|
+
if (best) {
|
|
125
|
+
if ((best.refreshAfter ?? best.expiresAt) <= Date.now()) {
|
|
126
|
+
scheduleFetch(releaseId);
|
|
127
|
+
}
|
|
123
128
|
return best.manifest;
|
|
129
|
+
}
|
|
124
130
|
// Also check the plain releaseId slot (non-ready / null entry).
|
|
125
131
|
const plain = manifestCache.get(releaseId);
|
|
126
132
|
if (plain && plain.expiresAt > Date.now()) {
|
|
@@ -153,11 +159,16 @@ function scheduleFetch(releaseId) {
|
|
|
153
159
|
: null;
|
|
154
160
|
if (manifest) {
|
|
155
161
|
const key = cacheKey(releaseId, manifest.manifestVersion);
|
|
156
|
-
manifestCache.set(key, {
|
|
162
|
+
manifestCache.set(key, {
|
|
163
|
+
manifest,
|
|
164
|
+
expiresAt: Date.now() + READY_TTL_MS,
|
|
165
|
+
refreshAfter: Date.now() + READY_REVALIDATE_MS,
|
|
166
|
+
});
|
|
157
167
|
logger.debug("Cached ready manifest", {
|
|
158
168
|
releaseId,
|
|
159
169
|
manifestVersion: manifest.manifestVersion,
|
|
160
170
|
ttlMs: READY_TTL_MS,
|
|
171
|
+
refreshMs: READY_REVALIDATE_MS,
|
|
161
172
|
});
|
|
162
173
|
}
|
|
163
174
|
else {
|