diff options
author | isaacs <i@izs.me> | 2014-05-15 10:56:55 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2014-05-15 11:10:23 +0400 |
commit | 00888fbb7470fd19db92c52a88ae1ee49d0e8160 (patch) | |
tree | 902f4b6ea93dd3ac433d638d4619424652b1918d /lib | |
parent | d5fa4d01f7bf91027acc933411010bae5676e102 (diff) |
getCacheStat: Prevent unnecessary stats with inflight
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cache/get-stat.js | 5 |
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()) { |