Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend Functionality, Check Functionality, Reentrant Lock Changes #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bnbalsamo
Copy link

@bnbalsamo bnbalsamo commented Aug 29, 2017

Implements the following new functionality:

  • Tests for python 3.5 and 3.6
  • Relevant boolean return value for RedLock.release_node()
  • Corresponding boolean return value for Redlock.release()
  • RedLock.check(): Checks to see if a lock is still held, returning a boolean
  • RedLock.check_times(): Checks to see if a lock is still held, and returns each nodes reported TTL for the lock
  • RedLock.extend(): Tries to extend the TTL of a lock back up to its original TTL
  • RedLock.extend_with_validity(): Same as above, also returning the new lock TTL
  • ReentrantRedLock.acquire_and_extend(): Acquires and extends (or just extends) a reentrant lock, incrementing the acquired counter.

Changes the following functionality:

  • ReentrantRedLocks now respect lock timeouts

Added some doc strings and comments here and there.

Tests were altered because of the changes to ReentrantRedLock - in order to
test the functionality the tests now required a real lock, rather than a
mock. Tests were also added for new functionality.

brian added 2 commits August 29, 2017 15:38
* Tests for python 3.5 and 3.6
* Relevant boolean return value for RedLock.release_node()
* Corresponding boolean return value for Redlock.release()
* RedLock.check(): Checks to see if a lock is still held, returning a boolean
* RedLock.check_times(): Checks to see if a lock is still held, and returns each nodes reported TTL for the lock
* RedLock.extend(): Tries to extend the ttl of a lock back up to it's original TTL
* RedLock.extend_with_validity(): Same as above, also returning the new lock TTL
* ReentrantRedLocks now respect lock timeouts, ReentrantRedLock.acquire() shouldn't return True in cases where the lock isn't actually held because it timed out

Added some docstrings and comments here and there

Tests were altered because of the changes to ReentrantRedLock - in order to
test the functionality the tests now required a real lock, rather than a
mock. Tests were also added for new functionality.
Extend Functionality, Check Functionality, Reentrant Lock Changes
@joaomoa
Copy link

joaomoa commented Apr 13, 2018

Is there a chance we can get this merged in? We have been using this branch at Smarkets and find the functionality quite useful.

We use the redlock to elect master from a pool of instances and the master keeps extending the lock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants