Eager load the Rails default controllers used in production (#50558)

Since those controller can be used in production we need to eager load
them to better copy-on-write and avoid tread-safety issues.
This commit is contained in:
Rafael Mendonça França 2024-01-03 11:44:09 -05:00 committed by GitHub
parent 826a3d1545
commit b0b1eb5a18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -27,13 +27,16 @@ module Rails
extend ActiveSupport::Autoload
extend ActiveSupport::Benchmarkable
autoload :HealthController
autoload :Info
autoload :InfoController
autoload :MailersController
autoload :PwaController
autoload :WelcomeController
eager_autoload do
autoload :HealthController
autoload :PwaController
end
class << self
@application = @app_class = nil

View File

@ -78,6 +78,7 @@ module Rails
if config.eager_load
ActiveSupport.run_load_hooks(:before_eager_load, self)
Zeitwerk::Loader.eager_load_all
Rails.eager_load!
config.eager_load_namespaces.each(&:eager_load!)
if config.reloading_enabled?