I'm trying to use RedLock to prevent 2 users from doing an operation on the same resource at once (Booking something too quickly from one another). But I want it to fail completely if the resource is already acquired by someone else (Booking availability will be gone after the transaction of request commits). It's not clear to me on docs what happens if the resource is still locked and how to fail at that point. Does it just throw an error? https://github.com/mike-marcacci/node-redlock#usage-promise-style.
const redlock = new Redlock(...);
let lock;
try {
lock = redlock.lock('bookId', 120000);
} catch (err) {
// ... lock failed to be acquired because someone else still had it? (after retries are finish)
}