sidekiq.rb 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # frozen_string_literal: true
  2. require_relative '../../lib/mastodon/sidekiq_middleware'
  3. Sidekiq.configure_server do |config|
  4. if Rails.configuration.database_configuration.dig('production', 'adapter') == 'postgresql_makara'
  5. STDERR.puts 'ERROR: Database replication is not currently supported in Sidekiq workers. Check your configuration.'
  6. exit 1
  7. end
  8. config.redis = REDIS_SIDEKIQ_PARAMS
  9. config.server_middleware do |chain|
  10. chain.add Mastodon::SidekiqMiddleware
  11. end
  12. config.server_middleware do |chain|
  13. chain.add SidekiqUniqueJobs::Middleware::Server
  14. end
  15. config.client_middleware do |chain|
  16. chain.add SidekiqUniqueJobs::Middleware::Client
  17. end
  18. SidekiqUniqueJobs::Server.configure(config)
  19. end
  20. Sidekiq.configure_client do |config|
  21. config.redis = REDIS_SIDEKIQ_PARAMS
  22. config.client_middleware do |chain|
  23. chain.add SidekiqUniqueJobs::Middleware::Client
  24. end
  25. end
  26. Sidekiq.logger.level = ::Logger.const_get(ENV.fetch('RAILS_LOG_LEVEL', 'info').upcase.to_s)
  27. SidekiqUniqueJobs.configure do |config|
  28. config.reaper = :ruby
  29. config.reaper_count = 1000
  30. config.reaper_interval = 600
  31. config.reaper_timeout = 150
  32. config.lock_ttl = 50.days.to_i
  33. end