Class: Discobolo::Client
- Inherits:
-
Disque
- Object
- Disque
- Discobolo::Client
- Defined in:
- lib/discobolo/client.rb
Instance Method Summary collapse
- #dequeue(queue) ⇒ Object
- #enqueue(queue) ⇒ Object
- #info ⇒ Object
- #jscan(queue, page = 0, count = 30) ⇒ Object
- #queue_lenght(queue) ⇒ Object
- #queue_stat(queue) ⇒ Object
- #show(jobid) ⇒ Object
- #working(jobid) ⇒ Object
Instance Method Details
#dequeue(queue) ⇒ Object
16 17 18 |
# File 'lib/discobolo/client.rb', line 16 def dequeue(queue) call("DEQUEUE", queue) end |
#enqueue(queue) ⇒ Object
20 21 22 |
# File 'lib/discobolo/client.rb', line 20 def enqueue(queue) call("ENQUEUE", queue) end |
#info ⇒ Object
42 43 44 |
# File 'lib/discobolo/client.rb', line 42 def info call("INFO") end |
#jscan(queue, page = 0, count = 30) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/discobolo/client.rb', line 29 def jscan(queue, page=0, count=30) jobs = [] Discobolo::Config.client.call("JSCAN", page, "COUNT", count, "QUEUE" , queue, "REPLY", "all").each do |job| next if job.is_a? String next if job.empty? job.each do |j| jobs << { results: Hash[*j] } end end.compact jobs #binding.pry end |
#queue_lenght(queue) ⇒ Object
12 13 14 |
# File 'lib/discobolo/client.rb', line 12 def queue_lenght(queue) call("QLEN", queue) end |
#queue_stat(queue) ⇒ Object
24 25 26 27 |
# File 'lib/discobolo/client.rb', line 24 def queue_stat(queue) Discobolo::Config.logger.error("QSTAT not implemented yet") #call("QSTAT", queue) end |
#show(jobid) ⇒ Object
4 5 6 |
# File 'lib/discobolo/client.rb', line 4 def show(jobid) Hash[ *call("SHOW", jobid)] end |
#working(jobid) ⇒ Object
8 9 10 |
# File 'lib/discobolo/client.rb', line 8 def working(jobid) call("WORKING", jobid) end |