Sha256: d23ce1f66dbf7e55b5599d8cd00b645963d928ba4fbff2eba181c33774d53592
Contents?: true
Size: 650 Bytes
Versions: 1
Compression:
Stored size: 650 Bytes
Contents
module Afterparty class Worker include QueueHelpers def consume @stopped = false # puts "starting worker with namespace [#{@options[:namespace]}]." @thread = Thread.new { consume_sync } @thread end def consume_next if (job = next_valid_job) run job end end def consume_sync while !@stopped job = next_valid_job if job puts "Executing job: #{job.id}" run job else sleep(@options[:sleep]) end end end def stop @stopped = true @thread.join(0) if @thread end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
afterparty-0.1.1 | lib/afterparty/worker.rb |