class SidekiqUniqueJobs::LockType
Calculates the lock type
Attributes
@!attribute [r] item
@return [Hash] the Sidekiq job hash
Public Class Methods
Source
# File lib/sidekiq_unique_jobs/lock_type.rb, line 17 def self.call(item) new(item).call end
Computes lock type from job arguments, sidekiq_options.
@return [Symbol] the lock type @return [NilClass] if no lock type is found.
Source
# File lib/sidekiq_unique_jobs/lock_type.rb, line 28 def initialize(item) @item = item self.job_class = item[CLASS] end
@param [Hash] item the Sidekiq
job hash @option item [Symbol, nil] :lock the type of lock to use. @option item [String] :class the class of the sidekiq worker
Public Instance Methods
Source
# File lib/sidekiq_unique_jobs/lock_type.rb, line 33 def call item[LOCK] || job_options[LOCK] || default_job_options[LOCK] end