Comments (2)
Hi @tomercagan,
It sounds like you have a pretty good read on how this works! The quick answer is that you'll need to store state somewhere else. Here's the longer answer:
You have a task that needs to be completed exactly once. This means that you have to account for failure at any stage of the task – even failures of the entire system (somebody might trip over the power cable). Let's break this down into its two parts:
The task must not complete MORE than once:
- If a task has been complete, we must not start it again
- If a task has been started, we must not start it again until we know whether it has completed or failed
The task must not complete LESS than once:
- If a task is created, it must start
- If a task fails:
- In the simplest cases, we can simply restart it
- If we keep "checkpoints" (divided it into smaller tasks) we can resume from the last complete sub-task
- If the task has side effects, we may need to revert and re-run, etc
There's a lot of other conditions/scenarios I could add above, but this hopefully illustrates the kinds of use case you have. In this scenario, redlock is only concerned with the problem in bold. While it's a very good solution to that problem, it doesn't provide much for addressing the other problems.
More generically, it's concerned with ensuring exclusivity in a distributed environment. Hopefully that helps – and free to follow up with more questions!
Cheers,
Mike
from node-redlock.
Hi @tomercagan,
I'm going to close this issue. Please feel free to reopen if you have further questions.
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.