Assume two server resources (A and B) processing a process with two steps. Client submits transaction request for RESOURCE_1 to A. Server A handles the first step Then via a job queue, B starts processing. I need to lock RESOURCE_1 at Server A and release lock from Server B.
- Can RedLock accommodate this requirement?
- If yes, how to release lock from Server B? Assume the lock key is known.
Current implementation is,
// server A
const lock = await redlock.lock(`LOCK:TX:RESOURCE_1 `, 999999);
await doLotOfStuff();
lock.unlock();
My expectation is,
// server A
const lock = await redlock.lock(`LOCK:TX:RESOURCE_1 `, 999999);
await doLotOfStuff();
await addToJobQueue(txRequest);
// server B
await doMoreStuff();
const lock = await redlock.find(`LOCK:TX:RESOURCE_1 `);
lock.unlock();