class SidekiqUniqueJobs::Orphans::Reaper
Class DeleteOrphans provides deletion of orphaned digests
@note this is a much slower version of the lua script but does not crash redis
@author Mikael Henriksson <mikael@mhenrixon.com>
Constants
- REAPERS
@return [Hash<Symbol, SidekiqUniqueJobs::Orphans::Reaper] the current implementation of reapers
Attributes
@!attribute [r] conn
@return [Redis] a redis connection
Public Class Methods
Execute deletion of orphaned digests
@param [Redis] conn nil a connection to redis
@return [void]
# File lib/sidekiq_unique_jobs/orphans/reaper.rb, line 39 def self.call(conn = nil) return new(conn).call if conn redis { |rcon| new(rcon).call } end
Initialize a new instance of DeleteOrphans
@param [Redis] conn a connection to redis
# File lib/sidekiq_unique_jobs/orphans/reaper.rb, line 55 def initialize(conn) @conn = conn end
Public Instance Methods
Delete orphaned digests
@return [Integer] the number of reaped locks
# File lib/sidekiq_unique_jobs/orphans/reaper.rb, line 105 def call if (implementation = REAPERS[reaper]) implementation.new(conn).call else log_fatal(":#{reaper} is invalid for `SidekiqUnqiueJobs.config.reaper`") end end
Convenient access to the global configuration
@return [SidekiqUniqueJobs::Config]
# File lib/sidekiq_unique_jobs/orphans/reaper.rb, line 65 def config SidekiqUniqueJobs.config end
The reaper that was configured
@return [Symbol]
# File lib/sidekiq_unique_jobs/orphans/reaper.rb, line 75 def reaper config.reaper end
The number of locks to reap at a time
@return [Integer]
# File lib/sidekiq_unique_jobs/orphans/reaper.rb, line 95 def reaper_count config.reaper_count end
The configured timeout for the reaper
@return [Integer] timeout in seconds
# File lib/sidekiq_unique_jobs/orphans/reaper.rb, line 85 def reaper_timeout config.reaper_timeout end