Module: Payola::Worker

Defined in:
lib/payola/worker.rb,
lib/payola/worker/base.rb,
lib/payola/worker/sidekiq.rb,
lib/payola/worker/active_job.rb,
lib/payola/worker/sucker_punch.rb

Defined Under Namespace

Classes: ActiveJob, BaseWorker, Sidekiq, SuckerPunch

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.registryObject

Returns the value of attribute registry.



9
10
11
# File 'lib/payola/worker.rb', line 9

def registry
  @registry
end

Class Method Details

.autofindObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/payola/worker.rb', line 19

def autofind
  # prefer ActiveJob over the other workers
  if Payola::Worker::ActiveJob.can_run?
    return Payola::Worker::ActiveJob
  end
  
  registry.values.each do |worker|
    if worker.can_run?
      return worker
    end
  end

  raise "No eligible background worker systems found."
end

.find(symbol) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/payola/worker.rb', line 11

def find(symbol)
  if registry.has_key? symbol
    return registry[symbol]
  else
    raise "No such worker type: #{symbol}"
  end
end