bakwc / PySyncObj

A library for replicating your python class between multiple servers, based on raft protocol
MIT License
706 stars 113 forks source link

Question: Does Lock in batteries support leader crash? #183

Closed foxleren closed 6 months ago

foxleren commented 6 months ago

Hi! I tried to use ReplLockManager as it is shown in project README.md, but I noticed that follower can't acquire Lock after leader crash and just freezes. Is it implemented in batteries?

bakwc commented 6 months ago

There is a configurable timeout for auto-expire to handle cases like this, called autoUnlockTime - it's the first and the single argument of ReplLockManager. In the readme it's set to 75 seconds. That mean that after 75 seconds lock will be unlocked.

Also keep in mind you need at least 3 nodes in a cluster, to be able to survive 1 node failure. It will not work for clusters of 1 or 2 nodes.