Sha256: 0f7bad307e8be0ce5d3da13fb46fd608ae85385c67e9e66b67079e0fca8632cd

Contents?: true

Size: 979 Bytes

Versions: 1

Compression:

Stored size: 979 Bytes

Contents

# frozen_string_literal: true

module Sidekiq
  module Grouping
    module Config
      include ActiveSupport::Configurable

      def self.options
        if Sidekiq.respond_to?(:[])
          Sidekiq[:grouping] || Sidekiq["grouping"] || {}
        else
          Sidekiq.options[:grouping] || Sidekiq.options["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.2.0 lib/sidekiq/grouping/config.rb