Comments (2)
Hi @natesilva, this is a good question, and you are right that the lock command doesn't really need to be an EVAL. However, the unlock and extend commands really do need to, and given this, I made the lock script an eval for the sake of symmetry and maximum extensibility (since these are technically overrideable).
The reason that we need to use EVAL is because to safely release a lock, we need to atomically check the lock identity before deleting it (to make sure it is not owned by some other process). Currently, the only way to do this in redis is through lau scripts (as far as I know).
I have actually been in a similar situation myself, and would like to see EVAL added to fakeredis or a similar library. However, for my case (running automated tests) it proved to be easy enough to create new redis containers on-demand, which ultimately provides more representative results.
from node-redlock.
Thank you for the detailed explanation. It does sound like setting up some test or on-demand Redis instances is the best option, and we’ll look into that.
from node-redlock.
Related Issues (20)
- Fix Typescript types resolution HOT 2
- Can i release a lock by key? HOT 1
- [QUESTION] Why does Redlock need to try to acquire the lock in all the N instances sequentially? HOT 1
- How to distinguish between initial quorom achievement and quorom renewal failures? HOT 1
- What is the key for redlock HOT 2
- `.using()` always creates a string? HOT 1
- Is there any document about errors that redlock emits?
- Redlock FIFO HOT 2
- Stable release when? HOT 1
- Superfluous type check
- String script parameter(s) ignored HOT 1
- Question about documentation in example snippet HOT 1
- High Availability Failure
- ETA for next v5 release? HOT 2
- Submitting a value for the lock
- Migration guide from 4.2.0 to 5.x?
- Redlock 4.x Compatible with Redit 7.x? HOT 1
- Unable to achieve a quorum during its retry window
- Cannot extend an already-expired lock crashes consumer pods. HOT 1
- Throw specific errors when there's an issue either acquiring or releasing the lock HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-redlock.