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.3.1 to 1.3.2

9

History.md

@@ -0,1 +1,10 @@

1.3.2
==================
* Handle errors from user-supplied callback better (Thank you @simeonborko)
* Ensure the array parameter does not get mutated for batch acquire (Thank you @taschmidt)
1.3.1
==================
* Show queue name in errors (thank you @luke-stead-sonocent)
1.3.0

@@ -2,0 +11,0 @@ ==================

21

lib/index.js

@@ -136,8 +136,16 @@ 'use strict';

var called = false;
fn(function (err, ret) {
try {
fn(function (err, ret) {
if (!called) {
called = true;
done(locked, err, ret);
}
});
} catch (err) {
// catching error thrown in user function fn
if (!called) {
called = true;
done(locked, err, ret);
done(locked, err);
}
});
}
}

@@ -235,6 +243,5 @@ else {

var fnx = fn;
keys.reverse().forEach(function (key) {
fnx = getFn(key, fnx);
});
var fnx = keys.reduceRight(function (prev, key) {
return getFn(key, prev);
}, fn);

@@ -241,0 +248,0 @@ if (typeof (cb) === 'function') {

{
"name": "async-lock",
"description": "Lock on asynchronous code",
"version": "1.3.1",
"version": "1.3.2",
"author": {

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

@@ -129,3 +129,3 @@ # async-lock

```js
// Specify timeout
// Specify timeout - max amount of time an item can remain in the queue before acquiring the lock
var lock = new AsyncLock({timeout: 5000});

@@ -136,3 +136,3 @@ lock.acquire(key, fn, function(err, ret) {

// Specify max occupation time
// Specify max occupation time - max amount of time allowed between entering the queue and completing execution
var lock = new AsyncLock({maxOccupationTime: 3000});

@@ -143,3 +143,3 @@ lock.acquire(key, fn, function(err, ret) {

// Set max pending tasks
// Set max pending tasks - max number of tasks allowed in the queue at a time
var lock = new AsyncLock({maxPending: 1000});

@@ -146,0 +146,0 @@ lock.acquire(key, fn, function(err, ret) {

Sorry, the diff of this file is not supported yet

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