Skip to content

Commit 56a27fa

Browse files
committed
fix: avoid caching manifests as promises
Originally this was in #7468: We backed off of it while we were rebuilding pacote's packument cache. Now that that's done we can assess this in isolation. I think it makes sense. The packument is cached here, all this is awaiting is normalization and ssri calculation. The only place this potentially does anything is in the premature loading of manifests in `#buildDepStep` when looking at problem edges. We can just wait till we need them and not throw a ton of requests in parallel before we actually need them. Removing the premature loading in problem edges will have to be a separate effort, as it is somehow load bearing
1 parent d3b9587 commit 56a27fa

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

workspaces/arborist/lib/arborist/build-ideal-tree.js

+9-13
Original file line numberDiff line numberDiff line change
@@ -1022,6 +1022,10 @@ This is a one-time fix-up, please be patient...
10221022
// may well be an optional dep that has gone missing. it'll
10231023
// fail later anyway.
10241024
for (const e of this.#problemEdges(placed)) {
1025+
// XXX This is somehow load bearing. This makes tests that print
1026+
// the ideal tree of a tree with tarball dependencies fail. This
1027+
// can't be changed or removed till we figure out why
1028+
// The test is named "tarball deps with transitive tarball deps"
10251029
promises.push(() =>
10261030
this.#fetchManifest(npa.resolve(e.name, e.spec, fromPath(placed, e)))
10271031
.catch(() => null)
@@ -1204,6 +1208,7 @@ This is a one-time fix-up, please be patient...
12041208
const options = {
12051209
...this.options,
12061210
avoid: this.#avoidRange(spec.name),
1211+
fullMetadata: true,
12071212
}
12081213
// get the intended spec and stored metadata from yarn.lock file,
12091214
// if available and valid.
@@ -1212,19 +1217,10 @@ This is a one-time fix-up, please be patient...
12121217
if (this.#manifests.has(spec.raw)) {
12131218
return this.#manifests.get(spec.raw)
12141219
} else {
1215-
const cleanRawSpec = redact(spec.rawSpec)
1216-
log.silly('fetch manifest', spec.raw.replace(spec.rawSpec, cleanRawSpec))
1217-
const o = {
1218-
...options,
1219-
fullMetadata: true,
1220-
}
1221-
const p = pacote.manifest(spec, o)
1222-
.then((mani) => {
1223-
this.#manifests.set(spec.raw, mani)
1224-
return mani
1225-
})
1226-
this.#manifests.set(spec.raw, p)
1227-
return p
1220+
log.silly('fetch manifest', spec.raw.replace(spec.rawSpec, redact(spec.rawSpec)))
1221+
const mani = await pacote.manifest(spec, options)
1222+
this.#manifests.set(spec.raw, mani)
1223+
return mani
12281224
}
12291225
}
12301226

0 commit comments

Comments
 (0)