Comparing version 0.2.2 to 0.3.0
@@ -28,3 +28,3 @@ var fs = require('fs') | ||
// cleanup | ||
Object.keys(locks).forEach(exports.unlockSync) | ||
try { Object.keys(locks).forEach(exports.unlockSync) } catch (e) {} | ||
process.removeListener('uncaughtException', H) | ||
@@ -174,2 +174,3 @@ throw er | ||
// console.error('wait', path, opts.wait) | ||
// wait for some ms for the lock to clear | ||
@@ -181,33 +182,8 @@ var start = Date.now() | ||
var now = Date.now() | ||
if (now > end) | ||
return | ||
// maybe already closed. | ||
try { watcher.close() } catch (e) {} | ||
clearTimeout(timer) | ||
var newWait = end - now | ||
var opts_ = Object.create(opts, { wait: { value: newWait }}) | ||
exports.lock(path, opts_, cb) | ||
var newOpts = Object.create(opts, { wait: { value: newWait }}) | ||
exports.lock(path, newOpts, cb) | ||
} | ||
try { | ||
var watcher = fs.watch(path, function (change) { | ||
if (change === 'rename') { | ||
// ok, try and get it now. | ||
// if this fails, then continue waiting, maybe. | ||
retry() | ||
} | ||
}) | ||
watcher.on('error', function (er) { | ||
// usually means it expired before the watcher spotted it | ||
retry() | ||
}) | ||
} catch (er) { | ||
retry() | ||
} | ||
var timer = setTimeout(function () { | ||
try { watcher.close() } catch (e) {} | ||
cb(er) | ||
}, opts.wait) | ||
var timer = setTimeout(retry, 10) | ||
} | ||
@@ -214,0 +190,0 @@ |
{ | ||
"name": "lockfile", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"main": "lockfile.js", | ||
@@ -5,0 +5,0 @@ "directories": { |
@@ -26,3 +26,3 @@ var test = require('tap').test | ||
// single lock, so this situation is somewhat pathological. | ||
var overhead = 20 | ||
var overhead = 200 | ||
var wait = N * overhead + delay | ||
@@ -29,0 +29,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
2
17154
440