Class: ActiveJob::QueueAdapters::PikaQueRails5

Inherits:
Object
  • Object
show all
Defined in:
lib/active_job/queue_adapters/pika_que_adapter.rb

Instance Method Summary collapse

Constructor Details

#initializePikaQueRails5

Returns a new instance of PikaQueRails5.



35
36
37
# File 'lib/active_job/queue_adapters/pika_que_adapter.rb', line 35

def initialize
  @monitor = Monitor.new
end

Instance Method Details

#enqueue(job) ⇒ Object

:nodoc:



39
40
41
42
43
# File 'lib/active_job/queue_adapters/pika_que_adapter.rb', line 39

def enqueue(job) #:nodoc:
  @monitor.synchronize do
    PikaQue::RailsWorker.enqueue job.serialize, to_queue: job.queue_name, priority: job.priority
  end
end

#enqueue_at(job, timestamp) ⇒ Object

:nodoc:



45
46
47
48
49
# File 'lib/active_job/queue_adapters/pika_que_adapter.rb', line 45

def enqueue_at(job, timestamp) #:nodoc:
  @monitor.synchronize do
    PikaQue::RailsWorker.enqueue_at job.serialize, timestamp, routing_key: job.queue_name
  end
end