Sha256: 594c3e1d2e5eb27f2e3d71c90e484d2c531a67edfb6b60bb8c3bcf93eb513c52

Contents?: true

Size: 1.21 KB

Versions: 9

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 Foo
      #       include Sidekiq::Worker
      #       include Sidekiq::Worker::Throttled
      #
      #       sidekiq_throttle :concurrency => { :limit => 42 }
      #     end
      #
      #     class Bar < Foo
      #     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

9 entries across 9 versions & 1 rubygems

Version Path
sidekiq-throttled-0.15.1 lib/sidekiq/throttled/configuration.rb
sidekiq-throttled-0.16.1 lib/sidekiq/throttled/configuration.rb
sidekiq-throttled-0.16.0 lib/sidekiq/throttled/configuration.rb
sidekiq-throttled-0.15.0 lib/sidekiq/throttled/configuration.rb
sidekiq-throttled-0.14.1 lib/sidekiq/throttled/configuration.rb
sidekiq-throttled-0.13.0 lib/sidekiq/throttled/configuration.rb
sidekiq-throttled-0.12.0 lib/sidekiq/throttled/configuration.rb
sidekiq-throttled-0.11.0 lib/sidekiq/throttled/configuration.rb
sidekiq-throttled-0.10.0 lib/sidekiq/throttled/configuration.rb