lib/zk/locker/locker_base.rb in zk-1.7.3 vs lib/zk/locker/locker_base.rb in zk-1.7.4
- old
+ new
@@ -325,11 +325,11 @@
# to ensure we don't accidentally remove a lock we don't own. see
# [rule #34](https://github.com/slyphon/zk/issues/34)...er, *issue* #34.
#
def create_lock_path!(prefix='lock')
@mutex.synchronize do
- @lock_path = @zk.create("#{root_lock_path}/#{prefix}", :mode => :ephemeral_sequential)
- @parent_stat = @zk.stat(root_lock_path)
+ @lock_path ||= @zk.create("#{root_lock_path}/#{prefix}", :mode => :ephemeral_sequential)
+ @parent_stat ||= @zk.stat(root_lock_path)
end
logger.debug { "got lock path #{@lock_path}" }
@lock_path
rescue NoNode