Git Product home page Git Product logo

Comments (4)

mike-marcacci avatar mike-marcacci commented on July 26, 2024 1

Hey @iamnewspecies! This is intentional. Due to the distributed nature of these locks, it is possible for a current lock to expire and a new one to be issued between the time your “unlock” command is issued and the time it hits the redis server. To prevent the command from unlocking the wrong lock (and invalidating all the guarantees of this software), it atomicly checks that the ID is correct before unlocking.

It would be quite unsafe to remove the lock based solely on the resource name.

If you want a more in-depth discussion of the redlock algorithm check out this article.

from node-redlock.

neil-119 avatar neil-119 commented on July 26, 2024 1

In our case, our backend instances cannot directly access Redis due to a limitation of our cloud provider. So, we spun up a VM to act as a "lock manager" server - however, we need a way to pass the lock id (not just resource id) back to the client, so that the client can send a separate request to the server with the same id, reconstruct the lock object, and release the same lock, if that makes sense. Is there a way to do this apart from maybe serializing that lock object?

from node-redlock.

mike-marcacci avatar mike-marcacci commented on July 26, 2024

@neil-119 that’s an interesting use case for sure. I would definitely be open to a PR that makes this easier, but right now you can create a new Redlock.Lock with resource and value.

from node-redlock.

Jonah246 avatar Jonah246 commented on July 26, 2024

I have a similar issue as @neil-119.

from node-redlock.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.