After upgrade to Rails 6 the initializers/sidekiq.rb
is causing deprecation warnings about class autoloading. As a workaround I thought I could wrap the contents of Sidekiq.configure_server
in Rails.application.config.after_initialize
. But after I do that, the job processor won't process the jobs anymore. This is the part that is causing error:
if Rails.env.development?
Sidekiq.options[:reloader] = proc do |&block|
ActionDispatch::Reloader.cleanup!
ActionDispatch::Reloader.prepare!
block.call
end
end
> NoMethodError: undefined method `cleanup!' for ActionDispatch::Reloader:Class
If I move that block around and just wrap everything else, it seemingly works. But I'm not sure I'm not causing more problems than I'm solving. Or perhaps there is a better way to solve the constant autoloading problem in Sidekiq initializer? Seeing that it is meant to use with Rails, surely there should be a simpler way to handle this.