lib/redis/objects/locks.rb in redis-objects-0.8.0 vs lib/redis/objects/locks.rb in redis-objects-0.9.0
- old
+ new
@@ -22,11 +22,11 @@
mod = Module.new do
define_method(lock_name) do |&block|
instance_variable_get("@#{lock_name}") or
instance_variable_set("@#{lock_name}",
Redis::Lock.new(
- redis_field_key(lock_name), redis, redis_objects[lock_name.to_sym]
+ redis_field_key(lock_name), redis_field_redis(lock_name), redis_objects[lock_name.to_sym]
)
)
end
end
@@ -47,10 +47,10 @@
# that was specified when the lock was defined.
def obtain_lock(name, id, &block)
verify_lock_defined!(name)
raise ArgumentError, "Missing block to #{self.name}.obtain_lock" unless block_given?
lock_name = "#{name}_lock"
- Redis::Lock.new(redis_field_key(lock_name, id), redis, redis_objects[lock_name.to_sym]).lock(&block)
+ Redis::Lock.new(redis_field_key(lock_name, id), redis_field_redis(lock_name), redis_objects[lock_name.to_sym]).lock(&block)
end
# Clear the lock. Use with care - usually only in an Admin page to clear
# stale locks (a stale lock should only happen if a server crashes.)
def clear_lock(name, id)