Sha256: 3ee723e7d6b5c4ea6e50ce8d1b086d1b6abd3532faff1e4d0b2f69f44490ae05
Contents?: true
Size: 609 Bytes
Versions: 2
Compression:
Stored size: 609 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. class Worker include Logging def initialize start_working end def start_working loop do next unless (job = Belated.fetch_job) break if job == :shutdown log call_job(job) log 'fetching jobs...' end end def call_job(job) if job.respond_to?(:call) job.call else job.perform end rescue StandardError => e e.inspect end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
belated-0.3.3 | lib/belated/worker.rb |
belated-0.3.2 | lib/belated/worker.rb |