node-redlock
node-redlock copied to clipboard
What is the key for redlock
let lock = await redlock.acquire(["ABC123"], 5000);
in above code , if I give key which is not present in redis db then code works fine. if i give key which is present in redis db then code throw's an error. Please let me know what is the key it's key exist in the redis db or it's just any string identifier for locking.
Error:
(node:22592) UnhandledPromiseRejectionWarning: ExecutionError: The operation was unable to achieve a quorum during its retry window.
I think it works as expected. If you set the key in redis, that key won't get removed thus redlock cannot acquire that.
"ABC123" is supposed to be the key for your lock, not for the resource you want to use. If 2 processes are trying to do the same thing when you only want a concurrency of 1, both processes should be using the same value for the lock key