diff --git a/lib/pkglock.js b/lib/pkglock.js index 4763e66..8bf6826 100644 --- a/lib/pkglock.js +++ b/lib/pkglock.js @@ -172,13 +172,13 @@ async function read ({ cache, hash, pkg, resolvedPath, isFile }) { throw new Error('read() requires a fully-resolved pkgmap file address') } try { - return ccGet.byDigest(cache, hash) + return ccGet.byDigest(cache, hash, { memoize: true }) } catch (err) { const newResolved = await fetchPackage(cache, pkg, hash) cache = newResolved.cache hash = newResolved.hash pkg = newResolved.pkg - return ccGet.byDigest(cache, hash) + return ccGet.byDigest(cache, hash, { memoize: true }) } } @@ -188,13 +188,13 @@ function readSync ({ cache, hash, pkg, resolvedPath, isFile }) { throw new Error('readSync() requires a fully-resolved pkgmap file address') } try { - return ccGet.sync.byDigest(cache, hash) + return ccGet.sync.byDigest(cache, hash, { memoize: true }) } catch (err) { const newResolved = fetchPackageSync(cache, pkg, hash) cache = newResolved.cache hash = newResolved.hash pkg = newResolved.pkg - return ccGet.sync.byDigest(cache, hash) + return ccGet.sync.byDigest(cache, hash, { memoize: true }) } } @@ -256,10 +256,10 @@ function statSync ({ cache, hash, pkg, resolvedPath, isDir }, verify) { } let info try { - info = ccGet.hasContent.sync(cache, hash) + info = ccGet.hasContent.sync(cache, hash, { memoize: true }) } catch (err) { fetchPackageSync(cache, pkg, hash) - info = ccGet.hasContent.sync(cache, hash) + info = ccGet.hasContent.sync(cache, hash, { memoize: true }) } if (!info) { return false @@ -289,7 +289,7 @@ function statSync ({ cache, hash, pkg, resolvedPath, isDir }, verify) { } function getPkg (cache, spec, scope, pkgName) { - const { metadata } = ccGet.sync(cache, depKey(spec, scope.dependencies[pkgName])) + const { metadata } = ccGet.sync(cache, depKey(spec, scope.dependencies[pkgName]), { memoize: true }) return JSON.parse(metadata) }