class ActiveJob::Uniqueness::LockManager
Redlock requires a value of the lock to release the resource by Redlock::Client#unlock method. LockManager
introduces LockManager#delete_lock
to unlock by resource key only. See github.com/leandromoreira/redlock-rb/issues/51 for more details.
Public Instance Methods
delete_lock(resource)
click to toggle source
Unlocks a resource by resource only.
# File lib/active_job/uniqueness/lock_manager.rb, line 10 def delete_lock(resource) @servers.each do |server| server.instance_variable_get(:'@redis').with do |conn| conn.del resource end end true end
delete_locks(wildcard)
click to toggle source
Unlocks multiple resources by key wildcard.
# File lib/active_job/uniqueness/lock_manager.rb, line 21 def delete_locks(wildcard) @servers.each do |server| server.instance_variable_get(:'@redis').with do |conn| conn.scan_each(match: wildcard).each { |key| conn.del key } end end true end