Browse Source
Rename second isState flags in both chains to cacheState, so it's clear what they represent in the next callback
pull/2/head
Wes Mason
9 years ago
No known key found for this signature in database
GPG Key ID: 121DB7952C93970C
1 changed files with
4 additions and
4 deletions
-
app.js
|
@ -44,8 +44,8 @@ app.get( '/:package', function( req, res, next ){ |
|
|
return fetchAndCacheMetadata( packageName, cacheFile ); |
|
|
return fetchAndCacheMetadata( packageName, cacheFile ); |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
.then( function( isExists ){ |
|
|
|
|
|
if ( !isExists ) { |
|
|
|
|
|
|
|
|
.then( function( cacheState ){ |
|
|
|
|
|
if ( !cacheState ) { |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
res._log.cacheFile = cacheFile; |
|
|
res._log.cacheFile = cacheFile; |
|
@ -79,9 +79,9 @@ app.get( '/:package/-/:tarball', function( req, res, next ){ |
|
|
return fetchAndCacheTarball( packageName, version, packagePath ); |
|
|
return fetchAndCacheTarball( packageName, version, packagePath ); |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
.then( function( isExists ){ |
|
|
|
|
|
|
|
|
.then( function( cacheState ){ |
|
|
res._log.cacheFile = packagePath; |
|
|
res._log.cacheFile = packagePath; |
|
|
if ( isExists ) { |
|
|
|
|
|
|
|
|
if ( cacheState ) { |
|
|
return res.sendFile( packagePath ); |
|
|
return res.sendFile( packagePath ); |
|
|
} else { |
|
|
} else { |
|
|
res.status( 404 ); |
|
|
res.status( 404 ); |
|
|