sidekiq.rb 650 B

123456789101112131415161718192021222324252627
  1. # frozen_string_literal: true
  2. namespace = ENV.fetch('REDIS_NAMESPACE') { nil }
  3. redis_params = { url: ENV['REDIS_URL'] }
  4. if namespace
  5. redis_params[:namespace] = namespace
  6. end
  7. Sidekiq.configure_server do |config|
  8. config.redis = redis_params
  9. config.server_middleware do |chain|
  10. chain.add SidekiqErrorHandler
  11. end
  12. config.death_handlers << lambda do |job, _ex|
  13. digest = job['lock_digest']
  14. SidekiqUniqueJobs::Digests.delete_by_digest(digest) if digest
  15. end
  16. end
  17. Sidekiq.configure_client do |config|
  18. config.redis = redis_params
  19. end
  20. Sidekiq.logger.level = ::Logger.const_get(ENV.fetch('RAILS_LOG_LEVEL', 'info').upcase.to_s)