Class: TResque::DelayExecutionWorker

Inherits:
Object
  • Object
show all
Extended by:
QueueLock, WorkerLock
Includes:
Worker
Defined in:
lib/tresque/delay_execution_worker.rb

Instance Attribute Summary

Attributes included from Worker

#enqueued_options

Class Method Summary collapse

Instance Method Summary collapse

Methods included from WorkerLock

around_perform_worker_lock, before_perform_worker_lock, clear_worker_lock, on_failure_worker_lock, worker_lock_timeout

Methods included from QueueLock

after_dequeue_queue_lock, before_enqueue_queue_lock, before_perform_queue_lock, clear_queue_lock, queue_lock_timeout

Methods included from Worker

#initialize, #requeue, #requeue!, #requeue_delay_seconds, #worker_perform

Class Method Details

.get_lock_namespace(options) ⇒ Object

handle dynamic locks



12
13
14
# File 'lib/tresque/delay_execution_worker.rb', line 12

def get_lock_namespace(options)
  options["lock_namespace"] || options["class_name"]
end

.get_queue_lock_attributes(options) ⇒ Object



16
17
18
19
# File 'lib/tresque/delay_execution_worker.rb', line 16

def get_queue_lock_attributes(options)
  return nil unless options["queue_lock"]
  [options["queue_lock"]].flatten
end

.get_worker_lock_attributes(options) ⇒ Object



21
22
23
24
# File 'lib/tresque/delay_execution_worker.rb', line 21

def get_worker_lock_attributes(options)
  return nil unless options["worker_lock"]
  [options["worker_lock"]].flatten
end

Instance Method Details

#workObject



27
28
29
30
31
32
33
34
# File 'lib/tresque/delay_execution_worker.rb', line 27

def work
  return unless record
  if args.nil? || args.empty?
    record.send(self.method_name)
  else
    record.send(self.method_name, *self.args)
  end
end