Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2014-05-15 10:56:55 +0400
committerisaacs <i@izs.me>2014-05-15 11:10:23 +0400
commit00888fbb7470fd19db92c52a88ae1ee49d0e8160 (patch)
tree902f4b6ea93dd3ac433d638d4619424652b1918d
parentd5fa4d01f7bf91027acc933411010bae5676e102 (diff)
getCacheStat: Prevent unnecessary stats with inflight
-rw-r--r--lib/cache/get-stat.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/cache/get-stat.js b/lib/cache/get-stat.js
index 6eff78baa..913f5af85 100644
--- a/lib/cache/get-stat.js
+++ b/lib/cache/get-stat.js
@@ -3,11 +3,16 @@ var mkdir = require("mkdirp")
, log = require("npmlog")
, chownr = require("chownr")
, npm = require("../npm.js")
+ , inflight = require("inflight")
// to maintain the cache dir's permissions consistently.
var cacheStat = null
module.exports = function getCacheStat (cb) {
if (cacheStat) return cb(null, cacheStat)
+
+ cb = inflight("getCacheStat", cb)
+ if (!cb) return
+
fs.stat(npm.cache, function (er, st) {
if (er) return makeCacheDir(cb)
if (!st.isDirectory()) {