2017-05-04 06:18:13 +09:00
|
|
|
# frozen_string_literal: true
|
2016-03-25 10:50:48 +09:00
|
|
|
|
2018-04-10 23:08:28 +09:00
|
|
|
namespace = ENV.fetch('REDIS_NAMESPACE') { nil }
|
2021-03-17 18:09:55 +09:00
|
|
|
redis_params = { url: ENV['REDIS_URL'], driver: :hiredis }
|
2017-05-08 02:42:32 +09:00
|
|
|
|
|
|
|
if namespace
|
2018-04-10 23:08:28 +09:00
|
|
|
redis_params[:namespace] = namespace
|
2017-05-08 02:42:32 +09:00
|
|
|
end
|
|
|
|
|
2016-03-25 10:50:48 +09:00
|
|
|
Sidekiq.configure_server do |config|
|
2017-05-08 02:42:32 +09:00
|
|
|
config.redis = redis_params
|
2018-02-25 03:16:11 +09:00
|
|
|
|
|
|
|
config.server_middleware do |chain|
|
|
|
|
chain.add SidekiqErrorHandler
|
|
|
|
end
|
2020-04-01 04:59:03 +09:00
|
|
|
|
2021-03-15 19:17:43 +09:00
|
|
|
config.server_middleware do |chain|
|
|
|
|
chain.add SidekiqUniqueJobs::Middleware::Server
|
|
|
|
end
|
|
|
|
|
|
|
|
config.client_middleware do |chain|
|
|
|
|
chain.add SidekiqUniqueJobs::Middleware::Client
|
2020-04-01 04:59:03 +09:00
|
|
|
end
|
2021-03-15 19:17:43 +09:00
|
|
|
|
|
|
|
SidekiqUniqueJobs::Server.configure(config)
|
2016-03-25 10:50:48 +09:00
|
|
|
end
|
|
|
|
|
|
|
|
Sidekiq.configure_client do |config|
|
2017-05-08 02:42:32 +09:00
|
|
|
config.redis = redis_params
|
2021-03-15 19:17:43 +09:00
|
|
|
|
|
|
|
config.client_middleware do |chain|
|
|
|
|
chain.add SidekiqUniqueJobs::Middleware::Client
|
|
|
|
end
|
2016-03-25 10:50:48 +09:00
|
|
|
end
|
2018-04-10 23:08:28 +09:00
|
|
|
|
2020-03-21 12:04:54 +09:00
|
|
|
Sidekiq.logger.level = ::Logger.const_get(ENV.fetch('RAILS_LOG_LEVEL', 'info').upcase.to_s)
|
2021-03-15 19:17:43 +09:00
|
|
|
|
|
|
|
SidekiqUniqueJobs.configure do |config|
|
|
|
|
config.reaper = :ruby
|
|
|
|
config.reaper_count = 1000
|
|
|
|
config.reaper_interval = 600
|
|
|
|
config.reaper_timeout = 150
|
|
|
|
end
|