Sha256: ead0fc9002bd748b46ae4830ed7bd4f2bd2332e806c409da08d987155b7a26bf

Contents?: true

Size: 969 Bytes

Versions: 4

Compression:

Stored size: 969 Bytes

Contents

module Karafka
  module Setup
    class Configurators
      # Class to configure all the Sidekiq settings based on Karafka settings
      class Sidekiq < Base
        # Sets up sidekiq client and server
        def setup
          setup_sidekiq_client
          setup_sidekiq_server
        end

        private

        # Configure sidekiq client
        def setup_sidekiq_client
          ::Sidekiq.configure_client do |sidekiq_config|
            sidekiq_config.redis = config.redis.to_h.merge(
              size: config.concurrency
            )
          end
        end

        # Configure sidekiq setorrver
        def setup_sidekiq_server
          ::Sidekiq.configure_server do |sidekiq_config|
            # We don't set size for the server - this will be set automatically based
            # on the Sidekiq concurrency level (Sidekiq not Karafkas)
            sidekiq_config.redis = config.redis.to_h
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
karafka-0.5.0.3 lib/karafka/setup/configurators/sidekiq.rb
karafka-0.5.0.2 lib/karafka/setup/configurators/sidekiq.rb
karafka-0.5.0.1 lib/karafka/setup/configurators/sidekiq.rb
karafka-0.5.0 lib/karafka/setup/configurators/sidekiq.rb