Sha256: 4f2092d1f3ebe0ec3a015adb5e78c88c699c94c544b4edc7aa4badc70897fe49

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

module Sidekiq
  module Grouping
    module Config
      include ActiveSupport::Configurable

      def self.options
        if Sidekiq.respond_to?(:[]) # Sidekiq 6.x
          Sidekiq[:grouping] || {}
        elsif Sidekiq.respond_to?(:options) # Sidekiq <= 5.x
          Sidekiq.options[:grouping] || Sidekiq.options["grouping"] || {}
        else # Sidekiq 7.x
          Sidekiq.default_configuration[:grouping] || {}
        end
      end

      # Queue size overflow check polling interval
      config_accessor :poll_interval do
        options[:poll_interval] || 3
      end

      # Maximum batch size
      config_accessor :max_batch_size do
        options[:max_batch_size] || 1000
      end

      # Batch queue flush lock timeout
      config_accessor :lock_ttl do
        options[:lock_ttl] || 1
      end

      # Option to override how Sidekiq::Grouping know about tests env
      config_accessor :tests_env do
        options[:tests_env] || (
          defined?(::Rails) && Rails.respond_to?(:env) && Rails.env.test?
        )
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sidekiq-grouping-1.3.0 lib/sidekiq/grouping/config.rb