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
Refactor extend life feature. #42
Conversation
* Remove Client#extend_life and #extend_life! methods, offer an additional extend_life option for Client#lock instead. * Pass options hash down the line to try_lock_instances, only there decide which script to use, etc. * Fix specs and testing helper. Fixes #36.
e536f71
to
7665862
Compare
@leandromoreira Coveralls is funny, coverage decreased as I removed a bunch of (covered) lines... The codeship CI tool I cannot access for some reason, seems it is private. Can you tell me what it says? |
One should not believe in coveralls small percentage
I'll check, I think we can remove it since we already have travis, what do you think? |
Sure, as said I can't even view it, so let's remove it :) |
Btw, @jonp gave his thumbs-up, so if you're fine with the changes, we could merge this before people start using |
if @testing_mode == :bypass | ||
{ | ||
validity: ttl, | ||
resource: resource, | ||
value: extend ? extend.fetch(:value) : SecureRandom.uuid | ||
value: options[:extend] ? options[:extend].fetch(:value) : SecureRandom.uuid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
options.fetch(:extend, SecureRandom.uuid)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, but we need options[:extend][:value]
Came late to the party :)
Nice addition @jonp. Would you be ok with the changes I did here? Instead of having a dedicated
extend_life
method, you can use theextend_life
parameter. Also keeps the semantics oflock
withextend
the same as before, and does not replicate behaviour oftry_lock_instances
inextend_life
method.