concurrent-lock
Promise based lock object supporting simultaneous access limit.
Install
npm install concurrent-lock
Usage
Create lock object with concurrent limit.
// concurrent access limit = 1const simultaneous_limit = 2const lock = simultaneous_limit async { await lock // ...some async proc... lock // you can set timeout argument as millisec // Timeout error will be thrown if lock couldn't acquire within specified timeout millisec. await lock // ...some async proc... lock}
Author
Yusuke Shibata
Licence
MIT