Class: QPush::Server::Queue

Inherits:
Object
  • Object
show all
Defined in:
lib/qpush/server/queue.rb

Overview

The Queue worker takes any jobs that are queued into our Redis server, and moves them to the appropriate list within Redis. It will perform a ‘blocking pop’ on our queue list until one is added.

Instance Method Summary collapse

Constructor Details

#initializeQueue

Returns a new instance of Queue.



8
9
10
# File 'lib/qpush/server/queue.rb', line 8

def initialize
  @done = false
end

Instance Method Details

#shutdownObject

Shutsdown our queue process.



23
24
25
# File 'lib/qpush/server/queue.rb', line 23

def shutdown
  @done = true
end

#startObject

Starts our queue process. This will run until instructed to stop.



14
15
16
17
18
19
# File 'lib/qpush/server/queue.rb', line 14

def start
  until @done
    job = retrieve_job
    job.setup if job
  end
end