Module: ActiveJob::ConcurrencyControls

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

Constant Summary collapse

DEFAULT_CONCURRENCY_GROUP =
->(*) { self.class.name }

Instance Method Summary collapse

Instance Method Details

#concurrency_keyObject



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/active_job/concurrency_controls.rb', line 26

def concurrency_key
  if self.class.concurrency_key
    param = compute_concurrency_parameter(self.class.concurrency_key)

    case param
    when ActiveRecord::Base
      [ concurrency_group, param.class.name, param.id ]
    else
      [ concurrency_group, param ]
    end.compact.join("/")
  end
end

#concurrency_limited?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/active_job/concurrency_controls.rb', line 39

def concurrency_limited?
  concurrency_key.present?
end