live-mutex: client will stuck after trying to acquire the lock 5 times
What I am trying to do is to write a higher level function to lock an array of keys and if one of them fails, unlock all acquired locks and sleep 1 second and retry. I created a client with lockRetryMax=2 and reuse the client in the same function. But when it tries to acquire the same lock 5 times, it just hang.
I found that in src/client.ts, it is hardcoded to 5 in the following line, any reason for that? It doesn’t resolve/reject the promise after 5 attempts right now. It seems deadlock right now.
if (rawLockCount - unlockCount > 5) {
this.lockQueues[key].unshift(arguments);
}
else {
this.lockInternal.apply(this, arguments);
}
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 26 (15 by maintainers)
Works great for my multi key race right now!
I published another new version - it turns out supporting the command line and programmatic usage is tricky - because at the command line the process can die, but you still want it to keep the lock. I only started supporting command line usage 2 weeks ago or so.