From 4b3d5edd1872d64adfea0c033feb10b859f2424a Mon Sep 17 00:00:00 2001 From: Mike Perham Date: Mon, 17 Oct 2016 10:54:46 -0700 Subject: [PATCH] Don't use the Reloader API at all when caching classes, #3154 --- lib/sidekiq/rails.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/sidekiq/rails.rb b/lib/sidekiq/rails.rb index a5ddc5ed..f1debb48 100644 --- a/lib/sidekiq/rails.rb +++ b/lib/sidekiq/rails.rb @@ -63,6 +63,10 @@ module Sidekiq # the ActiveRecord middleware so make sure it's not in the chain already. if defined?(Sidekiq::Middleware::Server::ActiveRecord) && Sidekiq.server_middleware.exists?(Sidekiq::Middleware::Server::ActiveRecord) raise ArgumentError, "You are using the Sidekiq ActiveRecord middleware and the new Rails 5 reloader which are incompatible. Please remove the ActiveRecord middleware from your Sidekiq middleware configuration." + elsif ::Rails.application.config.cache_classes + # The reloader API has proven to be troublesome under load in production. + # We won't use it at all when classes are cached, see #3154 + Sidekiq.logger.debug { "Autoload disabled in #{::Rails.env}, Sidekiq will not reload changed classes" } else Sidekiq.options[:reloader] = Sidekiq::Rails::Reloader.new end