Class: SidekiqUniqueJobs::Orphans::Reaper
- Inherits:
-
Object
- Object
- SidekiqUniqueJobs::Orphans::Reaper
- Includes:
- Connection, JSON, Logging, Script::Caller
- Defined in:
- lib/sidekiq_unique_jobs/orphans/reaper.rb
Overview
this is a much slower version of the lua script but does not crash redis
Class DeleteOrphans provides deletion of orphaned digests
Direct Known Subclasses
Constant Summary collapse
- REAPERS =
Returns Hash<Symbol, SidekiqUniqueJobs::Orphans::Reaper] the current implementation of reapers.
{ lua: SidekiqUniqueJobs::Orphans::RubyReaper, ruby: SidekiqUniqueJobs::Orphans::RubyReaper, none: SidekiqUniqueJobs::Orphans::NullReaper, nil => SidekiqUniqueJobs::Orphans::NullReaper, false => SidekiqUniqueJobs::Orphans::NullReaper, true => SidekiqUniqueJobs::Orphans::RubyReaper, }.freeze
Instance Attribute Summary collapse
-
#conn ⇒ Object
readonly
Returns the value of attribute conn.
Class Method Summary collapse
-
.call(conn = nil) ⇒ void
Execute deletion of orphaned digests.
Instance Method Summary collapse
-
#call ⇒ Integer
Delete orphaned digests.
-
#config ⇒ SidekiqUniqueJobs::Config
Convenient access to the global configuration.
-
#initialize(conn) ⇒ Reaper
constructor
Initialize a new instance of DeleteOrphans.
-
#reaper ⇒ Symbol
The reaper that was configured.
-
#reaper_count ⇒ Integer
The number of locks to reap at a time.
-
#reaper_timeout ⇒ Integer
The configured timeout for the reaper.
Methods included from JSON
dump_json, load_json, safe_load_json
Methods included from Logging
#build_message, included, #log_debug, #log_error, #log_fatal, #log_info, #log_warn, #logger, #logging_context, #with_configured_loggers_context, #with_logging_context
Methods included from Script::Caller
call_script, debug_lua, do_call, extract_args, max_history, normalize_argv, now_f, redis_version
Methods included from Connection
Constructor Details
#initialize(conn) ⇒ Reaper
Initialize a new instance of DeleteOrphans
56 57 58 |
# File 'lib/sidekiq_unique_jobs/orphans/reaper.rb', line 56 def initialize(conn) @conn = conn end |
Instance Attribute Details
#conn ⇒ Object (readonly)
Returns the value of attribute conn.
49 50 51 |
# File 'lib/sidekiq_unique_jobs/orphans/reaper.rb', line 49 def conn @conn end |
Class Method Details
.call(conn = nil) ⇒ void
This method returns an undefined value.
Execute deletion of orphaned digests
40 41 42 43 44 |
# File 'lib/sidekiq_unique_jobs/orphans/reaper.rb', line 40 def self.call(conn = nil) return new(conn).call if conn redis { |rcon| new(rcon).call } end |
Instance Method Details
#call ⇒ Integer
Delete orphaned digests
106 107 108 109 110 111 112 |
# File 'lib/sidekiq_unique_jobs/orphans/reaper.rb', line 106 def call if (implementation = REAPERS[reaper]) implementation.new(conn).call else log_fatal(":#{reaper} is invalid for `SidekiqUnqiueJobs.config.reaper`") end end |
#config ⇒ SidekiqUniqueJobs::Config
Convenient access to the global configuration
66 67 68 |
# File 'lib/sidekiq_unique_jobs/orphans/reaper.rb', line 66 def config SidekiqUniqueJobs.config end |
#reaper ⇒ Symbol
The reaper that was configured
76 77 78 |
# File 'lib/sidekiq_unique_jobs/orphans/reaper.rb', line 76 def reaper config.reaper end |
#reaper_count ⇒ Integer
The number of locks to reap at a time
96 97 98 |
# File 'lib/sidekiq_unique_jobs/orphans/reaper.rb', line 96 def reaper_count config.reaper_count end |
#reaper_timeout ⇒ Integer
The configured timeout for the reaper
86 87 88 |
# File 'lib/sidekiq_unique_jobs/orphans/reaper.rb', line 86 def reaper_timeout config.reaper_timeout end |