2017-05-03 17:18:13 -04:00
|
|
|
# frozen_string_literal: true
|
2016-03-24 21:50:48 -04:00
|
|
|
|
2018-04-10 10:08:28 -04:00
|
|
|
namespace = ENV.fetch('REDIS_NAMESPACE') { nil }
|
2017-05-07 13:42:32 -04:00
|
|
|
redis_params = { url: ENV['REDIS_URL'] }
|
|
|
|
|
|
|
|
if namespace
|
2018-04-10 10:08:28 -04:00
|
|
|
redis_params[:namespace] = namespace
|
2017-05-07 13:42:32 -04:00
|
|
|
end
|
|
|
|
|
2016-03-24 21:50:48 -04:00
|
|
|
Sidekiq.configure_server do |config|
|
2017-05-07 13:42:32 -04:00
|
|
|
config.redis = redis_params
|
2018-02-24 13:16:11 -05:00
|
|
|
|
|
|
|
config.server_middleware do |chain|
|
|
|
|
chain.add SidekiqErrorHandler
|
|
|
|
end
|
2020-03-31 15:59:03 -04:00
|
|
|
|
|
|
|
config.death_handlers << lambda do |job, _ex|
|
|
|
|
digest = job['lock_digest']
|
|
|
|
SidekiqUniqueJobs::Digests.delete_by_digest(digest) if digest
|
|
|
|
end
|
2016-03-24 21:50:48 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
Sidekiq.configure_client do |config|
|
2017-05-07 13:42:32 -04:00
|
|
|
config.redis = redis_params
|
2016-03-24 21:50:48 -04:00
|
|
|
end
|
2018-04-10 10:08:28 -04:00
|
|
|
|
2020-03-20 23:04:54 -04:00
|
|
|
Sidekiq.logger.level = ::Logger.const_get(ENV.fetch('RAILS_LOG_LEVEL', 'info').upcase.to_s)
|