diff options
author | Forrest L Norvell <forrest@npmjs.com> | 2014-09-26 09:01:45 +0400 |
---|---|---|
committer | Forrest L Norvell <forrest@npmjs.com> | 2014-09-26 12:59:57 +0400 |
commit | f24b552b596d0627549cdd7c2d68fcf9006ea50a (patch) | |
tree | 224adbab48438175d14bef9ea146ba0e5b92f471 /lib/cache/add-local-tarball.js | |
parent | ad54450104f94c82c501138b4eee488ce3a4555e (diff) |
lock cache → lock target
Rip out locking logic obviated by the new emphasis on atomic writes
within the cache; ensure that only one process can be writing to a given
module in node_modules at a time. All the tests pass?
Diffstat (limited to 'lib/cache/add-local-tarball.js')
-rw-r--r-- | lib/cache/add-local-tarball.js | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/lib/cache/add-local-tarball.js b/lib/cache/add-local-tarball.js index 10aa97681..d10bd3dd7 100644 --- a/lib/cache/add-local-tarball.js +++ b/lib/cache/add-local-tarball.js @@ -9,9 +9,6 @@ var mkdir = require("mkdirp") , npm = require("../npm.js") , tar = require("../utils/tar.js") , pathIsInside = require("path-is-inside") - , locker = require("../utils/locker.js") - , lock = locker.lock - , unlock = locker.unlock , getCacheStat = require("./get-stat.js") , chownr = require("chownr") , inflight = require("inflight") @@ -101,24 +98,12 @@ function addPlacedTarball_ (p, pkgData, uid, gid, resolvedSum, cb) { return } - lock(folder, function (er) { + mkdir(folder, function (er) { if (er) return cb(er) - - // async try/finally - var originalCb = cb - cb = function (er, data) { - unlock(folder, function (er2) { - return originalCb(er || er2, data) - }) - } - - mkdir(folder, function (er) { - if (er) return cb(er) - var pj = path.join(folder, "package.json") - var json = JSON.stringify(pkgData, null, 2) - writeFileAtomic(pj, json, function (er) { - cb(er, pkgData) - }) + var pj = path.join(folder, "package.json") + var json = JSON.stringify(pkgData, null, 2) + writeFileAtomic(pj, json, function (er) { + cb(er, pkgData) }) }) } |