You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now this module implements a binary semaphore pattern: only one resource is allowed inside the critical code block at a time. It would be nice to have an option that allows us to specify the number of resources that are allowed in, so a true semaphore. This API could be something like:
var testLock = new Lock({
redis: 'redis://localhost:6381',
namespace: 'mylock',
number: 5
});
testLock.acquireLock(id, 60 * 1000 /* Lock expires after 60sec if not released */ , function(err, lock) {
// Up to 5 resources are allowed inside the code block at time
});
The text was updated successfully, but these errors were encountered:
bradvogel
changed the title
Make true semaphore (add an option to limit to # of resources)
Make general semaphore (add an option to limit to # of resources)
Nov 10, 2021
Right now this module implements a binary semaphore pattern: only one resource is allowed inside the critical code block at a time. It would be nice to have an option that allows us to specify the number of resources that are allowed in, so a true semaphore. This API could be something like:
The text was updated successfully, but these errors were encountered: