Sha256: 77ca10360abba30b470fb0a27f06fdb1227358b194087c562e6e0efde733cdde

Contents?: true

Size: 1.21 KB

Versions: 5

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

module Sidekiq
  module Throttled
    # Configuration holder.
    class Configuration
      # Class constructor.
      def initialize
        reset!
      end

      # Reset configuration to defaults.
      #
      # @return [self]
      def reset!
        @inherit_strategies = false

        self
      end

      # Instructs throttler to lookup strategies in parent classes, if there's
      # no own strategy:
      #
      #     class FooJob
      #       include Sidekiq::Job
      #       include Sidekiq::Throttled::Job
      #
      #       sidekiq_throttle :concurrency => { :limit => 42 }
      #     end
      #
      #     class BarJob < FooJob
      #     end
      #
      # By default in the example above, `Bar` won't have throttling options.
      # Set this flag to `true` to enable this lookup in initializer, after
      # that `Bar` will use `Foo` throttling bucket.
      def inherit_strategies=(value)
        @inherit_strategies = value ? true : false
      end

      # Whenever throttled workers should inherit parent's strategies or not.
      # Default: `false`.
      #
      # @return [Boolean]
      def inherit_strategies?
        @inherit_strategies
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sidekiq-throttled-1.0.0.alpha.1 lib/sidekiq/throttled/configuration.rb
sidekiq-throttled-1.0.0.alpha lib/sidekiq/throttled/configuration.rb
sidekiq-throttled-0.18.0 lib/sidekiq/throttled/configuration.rb
sidekiq-throttled-0.17.0 lib/sidekiq/throttled/configuration.rb
sidekiq-throttled-0.16.2 lib/sidekiq/throttled/configuration.rb