2017-05-04 07:18:13 +10:00
|
|
|
# frozen_string_literal: true
|
2016-03-25 12:50:48 +11:00
|
|
|
|
2022-04-29 01:47:34 +10:00
|
|
|
require_relative '../../lib/mastodon/sidekiq_middleware'
|
2021-12-27 10:47:20 +11:00
|
|
|
|
2016-03-25 12:50:48 +11:00
|
|
|
Sidekiq.configure_server do |config|
|
2023-07-21 22:18:04 +10:00
|
|
|
if Rails.configuration.database_configuration.dig('production', 'adapter') == 'postgresql_makara'
|
|
|
|
STDERR.puts 'ERROR: Database replication is not currently supported in Sidekiq workers. Check your configuration.'
|
|
|
|
exit 1
|
|
|
|
end
|
|
|
|
|
2021-05-09 18:40:17 +10:00
|
|
|
config.redis = REDIS_SIDEKIQ_PARAMS
|
2018-02-25 05:16:11 +11:00
|
|
|
|
|
|
|
config.server_middleware do |chain|
|
2022-04-29 01:47:34 +10:00
|
|
|
chain.add Mastodon::SidekiqMiddleware
|
2018-02-25 05:16:11 +11:00
|
|
|
end
|
2020-04-01 06:59:03 +11:00
|
|
|
|
2021-03-15 21:17:43 +11: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 06:59:03 +11:00
|
|
|
end
|
2021-03-15 21:17:43 +11:00
|
|
|
|
|
|
|
SidekiqUniqueJobs::Server.configure(config)
|
2016-03-25 12:50:48 +11:00
|
|
|
end
|
|
|
|
|
|
|
|
Sidekiq.configure_client do |config|
|
2021-05-09 18:40:17 +10:00
|
|
|
config.redis = REDIS_SIDEKIQ_PARAMS
|
2021-03-15 21:17:43 +11:00
|
|
|
|
|
|
|
config.client_middleware do |chain|
|
|
|
|
chain.add SidekiqUniqueJobs::Middleware::Client
|
|
|
|
end
|
2016-03-25 12:50:48 +11:00
|
|
|
end
|
2018-04-11 00:08:28 +10:00
|
|
|
|
2020-03-21 14:04:54 +11:00
|
|
|
Sidekiq.logger.level = ::Logger.const_get(ENV.fetch('RAILS_LOG_LEVEL', 'info').upcase.to_s)
|
2021-03-15 21:17:43 +11:00
|
|
|
|
|
|
|
SidekiqUniqueJobs.configure do |config|
|
|
|
|
config.reaper = :ruby
|
|
|
|
config.reaper_count = 1000
|
|
|
|
config.reaper_interval = 600
|
|
|
|
config.reaper_timeout = 150
|
|
|
|
end
|