Class: SidekiqUniqueJobs::OnConflict::Reschedule

Inherits:
Strategy
  • Object
show all
Includes:
SidekiqWorkerMethods
Defined in:
lib/sidekiq_unique_jobs/on_conflict/reschedule.rb

Overview

Strategy to reschedule job on conflict

Author:

Instance Attribute Summary

Attributes inherited from Strategy

#item

Instance Method Summary collapse

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

#replace?

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.

Parameters:

  • item (Hash)

    sidekiq job hash



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

#callObject

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