app/services/hyrax/lock_manager.rb in hyrax-1.1.1 vs app/services/hyrax/lock_manager.rb in hyrax-2.0.0.beta1

- old
+ new

@@ -8,11 +8,11 @@ # @param [Fixnum] time_to_live How long to hold the lock in milliseconds # @param [Fixnum] retry_count How many times to retry to acquire the lock before raising UnableToAcquireLockError # @param [Fixnum] retry_delay Maximum wait time in milliseconds before retrying. Wait time is a random value between 0 and retry_delay. def initialize(time_to_live, retry_count, retry_delay) @ttl = time_to_live - @client = Redlock::Client.new([uri], retry_count: retry_count, retry_delay: retry_delay) + @client = Redlock::Client.new([Redis.current], retry_count: retry_count, retry_delay: retry_delay) end # Blocks until lock is acquired or timeout. def lock(key) returned_from_block = nil @@ -20,20 +20,7 @@ raise UnableToAcquireLockError unless locked returned_from_block = yield end returned_from_block end - - private - - def uri - @uri ||= begin - opts = options - URI("#{opts[:scheme]}://#{opts[:host]}:#{opts[:port]}").to_s - end - end - - def options - ::Redis.current.client.options - end end end