Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lockfile

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lockfile - npm Package Compare versions

Comparing version 0.2.2 to 0.3.0

34

lockfile.js

@@ -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 @@

2

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc