Sha256: e22cef722833c2c439cb20a7374d56d111441706ffd37e8016411b30b365b8c1

Contents?: true

Size: 578 Bytes

Versions: 1

Compression:

Stored size: 578 Bytes

Contents

# frozen_string_literal: true

require "sidekiq"

module Sidekiq
  module Throttled
    class UnitOfWork
      QUEUE_NAME_PREFIX_RE = /^.*queue:/
      private_constant :QUEUE_NAME_PREFIX_RE

      attr_reader :queue

      attr_reader :job

      def initialize(queue, job)
        @queue = queue
        @job   = job
      end

      def acknowledge
        # do nothing
      end

      def queue_name
        queue.sub(QUEUE_NAME_PREFIX_RE, "")
      end

      def requeue
        Sidekiq.redis { |conn| conn.rpush("queue:#{queue_name}", job) }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sidekiq-throttled-0.5.0 lib/sidekiq/throttled/unit_of_work.rb