Sha256: 1078a86bc33b2bc7c297d4bc1fbf2db071ebd4ecd8af8cad833109b44aecf43e

Contents?: true

Size: 706 Bytes

Versions: 1

Compression:

Stored size: 706 Bytes

Contents

# frozen_string_literal: true

require 'sidekiq'
require 'hiredis'

redis_config = {
  url: ENV.fetch('REDIS_URL') { 'redis://localhost:6379/0' },
  driver: 'hiredis'
}

Sidekiq.configure_client do |config|
  config.redis = redis_config.dup
end

Sidekiq.configure_server do |config|
  config.redis = redis_config.dup

  if Rails.env.staging? || Rails.env.production?
    config.log_formatter = ::EIVO::Formatter.new

    config.error_handlers << proc do |error, context|
      Sidekiq.logger.error {
        error: ["#{e.class.name}: #{e.message}", e.backtrace.to_s.join("\n")].join("\n"),
        context: context
      }
    end
  end
end

ActiveJob::Base.queue_adapter = :sidekiq if defined?(ActiveJob)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eivo-rails-sidekiq-0.1.2 config/initializers/sidekiq.rb