Class that allows calling asynchronous functions multiple times at once while only running one at a time.
const mutex = new Mutex();mutex.runExclusive(async () => { // Do some asynchronous stuff console.log('These run one-at-a-time');});mutex.runExclusive(async () => { // Do some asynchronous stuff console.log('These run one-at-a-time');}); Copy
const mutex = new Mutex();mutex.runExclusive(async () => { // Do some asynchronous stuff console.log('These run one-at-a-time');});mutex.runExclusive(async () => { // Do some asynchronous stuff console.log('These run one-at-a-time');});
See async-mutex for more information.
async-mutex
Optional
Class that allows calling asynchronous functions multiple times at once while only running one at a time.
Example
See
async-mutex
for more information.