Module: ActiveJob::Uniqueness::ActiveJobPatch

Extended by:
ActiveSupport::Concern
Defined in:
lib/active_job/uniqueness/active_job_patch.rb

Overview

Provides ability to make ActiveJob job unique.

For example:

class FooJob < ActiveJob::Base

queue_as :foo

unique :until_executed, lock_ttl: 3.hours

def perform(params)
  #...
end

end

Instance Method Summary collapse

Instance Method Details

#lock_key_argumentsObject

Override in your job class if you want to customize arguments set for a digest.



62
63
64
# File 'lib/active_job/uniqueness/active_job_patch.rb', line 62

def lock_key_arguments
  arguments
end

#lock_key_generatorObject



69
70
71
72
# File 'lib/active_job/uniqueness/active_job_patch.rb', line 69

def lock_key_generator
  @lock_key_generator ||= ActiveJob::Uniqueness::LockKey.new job_class_name: self.class.name,
                                                             arguments: lock_key_arguments
end

#lock_strategyObject



57
58
59
# File 'lib/active_job/uniqueness/active_job_patch.rb', line 57

def lock_strategy
  @lock_strategy ||= lock_strategy_class.new(job: self)
end