Sha256: b2c2266bc8ca1207dcbee9aa4f4c6cac03df18091c7edb754d1efcce08fd948a

Contents?: true

Size: 540 Bytes

Versions: 6

Compression:

Stored size: 540 Bytes

Contents

# frozen_string_literal: true

module Sidekiq
  module Throttled
    class Strategy
      module Base
        def limit(job_args = nil)
          @limit.respond_to?(:call) ? @limit.call(*job_args) : @limit
        end

        private

        def key(job_args)
          key = @base_key.dup
          return key unless @key_suffix

          key << ":#{@key_suffix.call(*job_args)}"
        rescue StandardError => e
          Sidekiq.logger.error "Failed to get key suffix: #{e}"
          raise e
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sidekiq-throttled-1.5.2 lib/sidekiq/throttled/strategy/base.rb
sidekiq-throttled-1.5.1 lib/sidekiq/throttled/strategy/base.rb
sidekiq-throttled-1.5.0 lib/sidekiq/throttled/strategy/base.rb
sidekiq-throttled-1.4.0 lib/sidekiq/throttled/strategy/base.rb
sidekiq-throttled-1.3.0 lib/sidekiq/throttled/strategy/base.rb
sidekiq-throttled-1.2.0 lib/sidekiq/throttled/strategy/base.rb