Skip to content
This repository has been archived by the owner on Jul 3, 2019. It is now read-only.

Commit

Permalink
fix(registry): fix infinite manifetch loop
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Apr 22, 2017
1 parent 5759d40 commit 6c6a62b
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions lib/registry/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,14 @@ function manifest (spec, opts) {
'registry:manifest',
`no matching version for ${spec.name}@${spec.fetchSpec} in the cache. Forcing revalidation`
)
opts.preferOffline = false
opts.preferOnline = true
return manifest(spec, opts)
return fetchPackument(uri, spec, registry, opts).then(packument => {
return pickManifest(packument, spec, {
engineFilter: opts.engineFilter,
defaultTag: opts.defaultTag
})
})
}
throw err
})
Expand Down Expand Up @@ -73,18 +79,19 @@ function fetchPackument (uri, spec, registry, opts) {
const startTime = Date.now()
const auth = opts.auth && opts.auth[registryKey(registry)]
const memo = opts.memoize && opts.memoize.get // `memoize` is a Map-like
const cacheMode = opts.offline
? 'only-if-cached'
: opts.preferOffline
? 'force-cache'
: opts.preferOnline
? 'no-cache'
: 'default'
return memo && memo.has(uri) ? BB.resolve(memo.get(uri)).then(p => {
opts.log.http('registry:manifest', `MEMOIZED ${uri}`)
return p
}) : fetch(uri, {
agent: opts.agent,
cache: opts.offline
? 'only-if-cached'
: opts.preferOffline
? 'force-cache'
: opts.preferOnline
? 'no-cache'
: 'default',
cache: cacheMode,
cacheManager: opts.cache,
headers: {
accept: opts.fullMetadata
Expand Down

0 comments on commit 6c6a62b

Please sign in to comment.