Class: SidekiqUniqueJobs::OnConflict::Reschedule
- Includes:
- SidekiqWorkerMethods
- Defined in:
- lib/sidekiq_unique_jobs/on_conflict/reschedule.rb
Overview
Strategy to reschedule job on conflict
Instance Attribute Summary
Attributes inherited from Strategy
Instance Method Summary collapse
-
#call ⇒ Object
Create a new job from the current one.
-
#initialize(item) ⇒ Reschedule
constructor
A new instance of Reschedule.
Methods included from SidekiqWorkerMethods
#after_unlock_hook, #default_worker_options, #sidekiq_worker_class?, #worker_class, #worker_class_constantize, #worker_method_defined?, #worker_options
Methods inherited from Strategy
Methods included from Logging
#log_debug, #log_error, #log_fatal, #log_info, #log_warn, #logger, #logging_context
Constructor Details
#initialize(item) ⇒ Reschedule
Returns a new instance of Reschedule.
12 13 14 15 |
# File 'lib/sidekiq_unique_jobs/on_conflict/reschedule.rb', line 12 def initialize(item) super @worker_class = item[CLASS_KEY] end |
Instance Method Details
#call ⇒ Object
Create a new job from the current one.
This will mess up sidekiq stats because a new job is created
19 20 21 |
# File 'lib/sidekiq_unique_jobs/on_conflict/reschedule.rb', line 19 def call worker_class&.perform_in(5, *item[ARGS_KEY]) if sidekiq_worker_class? end |