2017-05-03 17:18:13 -04:00
|
|
|
# frozen_string_literal: true
|
2016-03-24 21:50:48 -04:00
|
|
|
|
2022-04-28 11:47:34 -04:00
|
|
|
require_relative '../../lib/mastodon/sidekiq_middleware'
|
2021-12-26 18:47:20 -05:00
|
|
|
|
2016-03-24 21:50:48 -04:00
|
|
|
Sidekiq.configure_server do |config|
|
2021-05-09 04:40:17 -04:00
|
|
|
config.redis = REDIS_SIDEKIQ_PARAMS
|
2018-02-24 13:16:11 -05:00
|
|
|
|
|
|
|
config.server_middleware do |chain|
|
2022-04-28 11:47:34 -04:00
|
|
|
chain.add Mastodon::SidekiqMiddleware
|
2018-02-24 13:16:11 -05:00
|
|
|
end
|
2020-03-31 15:59:03 -04:00
|
|
|
|
2021-03-15 06:17:43 -04:00
|
|
|
config.server_middleware do |chain|
|
|
|
|
chain.add SidekiqUniqueJobs::Middleware::Server
|
|
|
|
end
|
|
|
|
|
|
|
|
config.client_middleware do |chain|
|
|
|
|
chain.add SidekiqUniqueJobs::Middleware::Client
|
2020-03-31 15:59:03 -04:00
|
|
|
end
|
2021-03-15 06:17:43 -04:00
|
|
|
|
2023-10-23 11:46:21 -04:00
|
|
|
config.on(:startup) do
|
|
|
|
if SelfDestructHelper.self_destruct?
|
|
|
|
Sidekiq.schedule = {
|
|
|
|
'self_destruct_scheduler' => {
|
|
|
|
'interval' => ['1m'],
|
|
|
|
'class' => 'Scheduler::SelfDestructScheduler',
|
|
|
|
'queue' => 'scheduler',
|
|
|
|
},
|
|
|
|
}
|
2024-02-06 10:32:09 -05:00
|
|
|
SidekiqScheduler::Scheduler.instance.reload_schedule!
|
2023-10-23 11:46:21 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-03-15 06:17:43 -04:00
|
|
|
SidekiqUniqueJobs::Server.configure(config)
|
2016-03-24 21:50:48 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
Sidekiq.configure_client do |config|
|
2021-05-09 04:40:17 -04:00
|
|
|
config.redis = REDIS_SIDEKIQ_PARAMS
|
2021-03-15 06:17:43 -04:00
|
|
|
|
|
|
|
config.client_middleware do |chain|
|
|
|
|
chain.add SidekiqUniqueJobs::Middleware::Client
|
|
|
|
end
|
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)
|
2021-03-15 06:17:43 -04:00
|
|
|
|
|
|
|
SidekiqUniqueJobs.configure do |config|
|
2023-11-09 11:19:04 -05:00
|
|
|
config.enabled = !Rails.env.test?
|
2021-03-15 06:17:43 -04:00
|
|
|
config.reaper = :ruby
|
|
|
|
config.reaper_count = 1000
|
|
|
|
config.reaper_interval = 600
|
|
|
|
config.reaper_timeout = 150
|
2022-10-26 06:10:48 -04:00
|
|
|
config.lock_ttl = 50.days.to_i
|
2021-03-15 06:17:43 -04:00
|
|
|
end
|