Sha256: 31d5b3ae659883a78f356598ffa16fba38c2cccc188a4883e406be2f1b70d008

Contents?: true

Size: 488 Bytes

Versions: 5

Compression:

Stored size: 488 Bytes

Contents

# Encoding: utf-8

module Reqless
  module JobReservers
    class Ordered
      attr_reader :queues

      def initialize(queues)
        @queues = queues
      end

      def reserve
        @queues.each do |q|
          job = q.pop
          return job if job
        end
        nil
      end

      def prep_for_work!
        # nothing here on purpose
      end

      def description
        @description ||= @queues.map(&:name).join(', ') + ' (ordered)'
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
reqless-0.0.5 lib/reqless/job_reservers/ordered.rb
reqless-0.0.4 lib/reqless/job_reservers/ordered.rb
reqless-0.0.3 lib/reqless/job_reservers/ordered.rb
reqless-0.0.2 lib/reqless/job_reservers/ordered.rb
reqless-0.0.1 lib/reqless/job_reservers/ordered.rb