Sha256: ba8585610752ca291d9b696e1c0f10d22f3dc06d96e4c8ccebd0be423451d7d9

Contents?: true

Size: 662 Bytes

Versions: 4

Compression:

Stored size: 662 Bytes

Contents

module Sidekiq
  class LimitFetch::UnitOfWork < BasicFetch::UnitOfWork
    def initialize(queue, job)
      if post_6_5?
        super(queue, job, Sidekiq)
      else
        super
      end
      redis_retryable { Queue[queue_name].increase_busy }
    end

    def acknowledge
      redis_retryable { Queue[queue_name].decrease_busy }
      redis_retryable { Queue[queue_name].release }
    end

    def requeue
      super
      acknowledge
    end

    private

    def post_6_5?
      Gem::Version.new(Sidekiq::VERSION) >= Gem::Version.new('6.5.0')
    end

    def redis_retryable(&block)
      Sidekiq::LimitFetch.redis_retryable(&block)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sidekiq-limit_fetch-4.4.0 lib/sidekiq/limit_fetch/unit_of_work.rb
sidekiq-limit_fetch-4.3.2 lib/sidekiq/limit_fetch/unit_of_work.rb
sidekiq-limit_fetch-4.3.1 lib/sidekiq/limit_fetch/unit_of_work.rb
sidekiq-limit_fetch-4.3.0 lib/sidekiq/limit_fetch/unit_of_work.rb