Sha256: 643a9b5cf93ad183c2ece5f931f3e6638bba58f5b41169347b1328f739849027
Contents?: true
Size: 632 Bytes
Versions: 1
Compression:
Stored size: 632 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.is_a?(Symbol) log "Worker #{@number} got job: #{job.inspect}" log job.perform rescue RangeError => e log e end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
belated-0.5.6 | lib/belated/worker.rb |