microfleet / ioredis-lock

Node distributed locking using redis
MIT License
26 stars 8 forks source link

Multiple locks? #14

Closed GLOWTIPS closed 7 years ago

GLOWTIPS commented 7 years ago

Hi, I'm having trouble implementing multiple locks. Is it possible?

lock.acquire('for:counter').then(function() {
    // Do stuff...

    return lock.release();
});

lock.acquire('for:client:' + x).then(function() {
    // Do stuff...

    return lock.release();
});

...I get LockReleaseError. I know, I'm concurrently acquiring 2 locks, before checking the release of another. But they have unique ids - so are they not kept separate?