const redlock = new Redlock([ioClient], {
retryCount: -1,
});
const LOCK_TTL = 1_000;
const lock = await redlock.acquire(["someKey"], LOCK_TTL)
await new Promise(f => setTimeout(f, 5_000));
await lock.release();
// It never reaches here if the lock has expired
doSomethingElse()
If the lock expires, the code is stuck on release() function.
- Is this behavior expected? I suspect it retries
release() forever based onretryCount, but can I have different retryCount for acquiring and releasing?
- How do I check if the lock has expired, so I can skip the
release() call?
I am connecting to a single Redis node
If the lock expires, the code is stuck on
release()function.release()forever based onretryCount, but can I have differentretryCountfor acquiring and releasing?release()call?I am connecting to a single Redis node