Sha256: ced60f30f01fd5d4affe4e9b2d5e3688feb7f6337d6190afa56c946af96038be
Contents?: true
Size: 854 Bytes
Versions: 2
Compression:
Stored size: 854 Bytes
Contents
module QPush module Server # The Perform worker runs any jobs that are queued into our Redis server. # It will perform a 'blocking pop' on our job list until one is added. # class Perform def initialize @done = false end # Starts our perform process. This will run until instructed to stop. # def start until @done job = retrieve_job job.execute if job end end # Shutsdown our perform process. # def shutdown @done = true end private # Performs a 'blocking pop' on our redis job list. # def retrieve_job json = Server.redis { |c| c.brpop(Server.keys.perform_list) } Job.new(JSON.parse(json.last)) rescue => e raise ServerError, e.message end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
qpush-0.1.7 | lib/qpush/server/perform.rb |
qpush-0.1.6 | lib/qpush/server/perform.rb |