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.



65
66
67
# File 'lib/active_job/uniqueness/active_job_patch.rb', line 65

def lock_key_arguments
  arguments
end

#lock_key_generatorObject



72
73
74
75
# File 'lib/active_job/uniqueness/active_job_patch.rb', line 72

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

#lock_strategyObject



60
61
62
# File 'lib/active_job/uniqueness/active_job_patch.rb', line 60

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