Chatwoot/config/initializers/sidekiq.rb
Arkadiy Ayvazyan 86ca7f4a8d
fix: Autoloading during initialization deprecation warning (#5628)
Autoloading during initialization deprecation warning fix
fixes: #4012
2022-11-01 20:19:42 -07:00

17 lines
530 B
Ruby

require Rails.root.join('lib/redis/config')
schedule_file = 'config/schedule.yml'
Sidekiq.configure_client do |config|
config.redis = Redis::Config.app
end
Sidekiq.configure_server do |config|
config.redis = Redis::Config.app
config.logger.level = Logger.const_get(ENV.fetch('LOG_LEVEL', 'info').upcase.to_s)
end
# https://github.com/ondrejbartas/sidekiq-cron
Rails.application.reloader.to_prepare do
Sidekiq::Cron::Job.load_from_hash YAML.load_file(schedule_file) if File.exist?(schedule_file) && Sidekiq.server?
end