Sha256: c01a83569cd5743d7ca8ddbc82c743b44682bdab2012634e9118451fd3caab8b
Contents?: true
Size: 584 Bytes
Versions: 5
Compression:
Stored size: 584 Bytes
Contents
require_relative 'logging' class Belated # The worker class that actually gets the jobs from the queue # and calls them. Expects the jobs to be procs or # classes that have a perform method. class Worker include Logging def initialize(number: 1) @number = number start_working end def start_working loop do log "Worker #{@number} fetching jobs!" next unless (job = Belated.fetch_job) break if job == :shutdown log "Worker #{@number} got job: #{job.inspect}" job.perform end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
belated-0.5.4 | lib/belated/worker.rb |
belated-0.5.3 | lib/belated/worker.rb |
belated-0.5.2 | lib/belated/worker.rb |
belated-0.5.1 | lib/belated/worker.rb |
belated-0.5.0 | lib/belated/worker.rb |