Sha256: 6c65ca3acd50c4d3dc2d2aae63ba6a5255dd09d805676af258a314fa39ba9054
Contents?: true
Size: 918 Bytes
Versions: 3
Compression:
Stored size: 918 Bytes
Contents
module QPush module Server # 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. # class Queue def initialize @done = false end # Starts our queue process. This will run until instructed to stop. # def start until @done job = retrieve_job job.api.setup if job end end # Shutsdown our queue process. # def shutdown @done = true end private # Performs a 'blocking pop' on our redis job list. # def retrieve_job json = QPush.redis.with { |c| c.brpop(QPush.config.queue_namespace) } Job.new(JSON.parse(json.last)) rescue => e raise ServerError, e.message end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
qpush-0.1.2 | lib/qpush/server/queue.rb |
qpush-0.1.1 | lib/qpush/server/queue.rb |
qpush-0.1.0 | lib/qpush/server/queue.rb |