Sha256: 026fdc129a69d68c32b5e3fb5ddf21d8cd41e2dc8e73c3fc3b6f71011ab934a8

Contents?: true

Size: 613 Bytes

Versions: 8

Compression:

Stored size: 613 Bytes

Contents

module QueueClassicMatchers
  class TestWorker < QC::Worker
    def initialize(options)
      @klasses = options.delete(:klasses)
      super(options)
    end

    def handle_failure(job, e)
      raise e
    end

    def process(queue, job)
      # Skip over task not matching klasses
      k = job[:method].split('.').first
      if @klasses.nil? || klasses.include?(k)
        super
      else
        # Uncomment for debugging
        # puts "Skipping #{job[:method]}. Klassed: #{klasses.inspect}"
        queue.delete(job[:id])
      end
    end

    def klasses
      @klasses.map(&:to_s)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
queue_classic_matchers-4.0.0.alpha2 lib/queue_classic_matchers/test_worker.rb
queue_classic_matchers-4.0.0.alpha1 lib/queue_classic_matchers/test_worker.rb
queue_classic_matchers-1.1.0 lib/queue_classic_matchers/test_worker.rb
queue_classic_matchers-1.0.2 lib/queue_classic_matchers/test_worker.rb
queue_classic_matchers-0.0.4 lib/queue_classic_matchers/test_worker.rb
queue_classic_matchers-0.0.3 lib/queue_classic_matchers/test_worker.rb
queue_classic_matchers-0.0.2 lib/queue_classic_matchers/test_worker.rb
queue_classic_matchers-0.0.1 lib/queue_classic_matchers/test_worker.rb