Socket
Socket
Sign inDemoInstall

async-lock

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-lock - npm Package Compare versions

Comparing version 1.2.7 to 1.2.8

6

History.md

@@ -1,5 +0,9 @@

1.2.7
1.2.8
==================
* Fix #37 process not set when acquiring lock (Thank you @Philipp91)
1.2.7
==================
DO NOT USE, erroneous publish
1.2.6

@@ -6,0 +10,0 @@ ==================

20

lib/index.js

@@ -12,7 +12,13 @@ 'use strict';

// domain of current running func {key : fn}
this.domains = Object.create(null);
// lock is reentrant for same domain
this.domainReentrant = opts.domainReentrant || false;
if (this.domainReentrant) {
if (typeof process === 'undefined' || typeof process.domain === 'undefined') {
throw new Error(
'Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, ' +
'use a NodeJS version that still implements Domain, or install a browser polyfill.');
}
// domain of current running func {key : fn}
this.domains = Object.create(null);
}

@@ -74,3 +80,5 @@ this.timeout = opts.timeout || AsyncLock.DEFAULT_TIMEOUT;

}
delete self.domains[key];
if (self.domainReentrant) {
delete self.domains[key];
}
}

@@ -114,3 +122,3 @@

if (locked) {
if (self.domainReentrant && locked) {
self.domains[key] = process.domain;

@@ -141,3 +149,3 @@ }

};
if (!!process.domain) {
if (self.domainReentrant && !!process.domain) {
exec = process.domain.bind(exec);

@@ -144,0 +152,0 @@ }

{
"name": "async-lock",
"description": "Lock on asynchronous code",
"version": "1.2.7",
"version": "1.2.8",
"author": {

@@ -6,0 +6,0 @@ "name": "Rogier Schouten",

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