Socket
Socket
Sign inDemoInstall

proper-lockfile

Package Overview
Dependencies
3
Maintainers
2
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.0.0 to 4.1.0

10

CHANGELOG.md

@@ -5,2 +5,12 @@ # Change Log

<a name="4.1.0"></a>
# [4.1.0](https://github.com/moxystudio/node-proper-lockfile/compare/v4.0.0...v4.1.0) (2019-03-18)
### Features
* allow second precision in mtime comparison ([#78](https://github.com/moxystudio/node-proper-lockfile/issues/78)) ([b2816a6](https://github.com/moxystudio/node-proper-lockfile/commit/b2816a6))
<a name="4.0.0"></a>

@@ -7,0 +17,0 @@ # [4.0.0](https://github.com/moxystudio/node-proper-lockfile/compare/v3.2.0...v4.0.0) (2019-03-12)

26

lib/lockfile.js

@@ -114,3 +114,3 @@ 'use strict';

const isMtimeOurs = lock.mtime.getTime() === stat.mtime.getTime();
const isMtimeOurs = lock.mtimeChecker(lock.mtime, stat.mtime);

@@ -233,2 +233,3 @@ if (!isMtimeOurs) {

lastUpdate: Date.now(),
mtimeChecker: createMtimeChecker(),
};

@@ -314,2 +315,25 @@

function createMtimeChecker() {
let precision;
return (lockMtime, statMtime) => {
// If lock time was not on the second we can determine precision
if (!precision && lockMtime % 1000 !== 0) {
precision = statMtime % 1000 === 0 ? 's' : 'ms';
}
if (precision === 's') {
const lockTs = lockMtime.getTime();
const statTs = statMtime.getTime();
// Maybe the file system truncates or rounds...
return Math.trunc(lockTs / 1000) === Math.trunc(statTs / 1000) ||
Math.round(lockTs / 1000) === Math.round(statTs / 1000);
}
// Must be ms or lockMtime was on the second
return lockMtime.getTime() === statMtime.getTime();
};
}
// Remove acquired locks on exit

@@ -316,0 +340,0 @@ /* istanbul ignore next */

2

package.json
{
"name": "proper-lockfile",
"version": "4.0.0",
"version": "4.1.0",
"description": "A inter-process and inter-machine lockfile utility that works on a local or network file system",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc