Class: Quiq::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/quiq/client.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.push(job, scheduled_at: nil) ⇒ Object



18
19
20
# File 'lib/quiq/client.rb', line 18

def self.push(job, scheduled_at: nil)
  new.push(job, scheduled_at)
end

Instance Method Details

#push(job, scheduled_at) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/quiq/client.rb', line 8

def push(job, scheduled_at)
  serialized_job = JSON.dump(job.serialize)

  if scheduled_at
    Async { Scheduler.enqueue_at(serialized_job, scheduled_at) }
  else
    Async { Queue.push(job.queue_name, serialized_job) }
  end
end