Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Railties] Add config rake_eager_load #28209

Open
wants to merge 1 commit into
base: master
from

Conversation

@tjoyal
Copy link
Contributor

commented Feb 27, 2017

Summary

Rake environment disable config.eager_load for from what I understand legacy reasons.

https://github.com/rails/rails/blob/v5.0.1/railties/lib/rails/application.rb#L446

I would wish to be able to control that behaviour so regardless how the application is accessed, the load order remains the same.

I added a new accessor in Rails::Application::Configuration to minimize the diff, but it could be nice to split the mass creation to one per line and 馃敗 ?

@guilleiguaran
Copy link
Member

left a comment

馃憤

@kirs

This comment has been minimized.

Copy link
Member

commented Feb 27, 2017

Looks as a great path to start towards deprecating the old behaviour 馃憤

@olivierlacan

This comment has been minimized.

Copy link
Contributor

commented Mar 10, 2017

@tjoyal Excellent PR. The legacy reason was bad interaction with rake assets precompile I believe, where a database connection was attempted due to eager loading.

I would make a bigger deal about this in the changelog if I were you since the previous change to make rake task never eager load was a sizable regression that could cause very problematic issues with thread safety in rake tasks.

@@ -1,3 +1,11 @@
* Allow configuration of eager_load behaviour for rake environment:

This comment has been minimized.

Copy link
@olivierlacan

olivierlacan Mar 10, 2017

Contributor

I would say "class eager_load` behavior" here to avoid potential confusions with ActiveRecord eager loading. I get that we're not in the AR changelog but you never know. :-p

@rafaelfranca

This comment has been minimized.

Copy link
Member

commented Mar 10, 2017

For now we don't want to advertise this feature too much since it is going to be just a workaround to get it shipped in Rails 5.1 and that will be removed in 5.2. In the long term all the rake tasks will have eager loading disabled and we will give users a mechanism to eager load the tasks they want. We are also going to kill most of the Rake tasks in favor of Rails commands that will respect the configurations.

@seandilda

This comment has been minimized.

Copy link

commented Aug 3, 2018

What's the current status on this? I'm still seeing eager_load problems with tasks in 5.2

@timz1290

This comment has been minimized.

Copy link

commented Aug 29, 2018

@seandilda - same here, we'd also like eager loading to be configurable in rake tasks

@randoum

This comment has been minimized.

Copy link

commented Jan 30, 2019

For now we don't want to advertise this feature too much since it is going to be just a workaround to get it shipped in Rails 5.1 and that will be removed in 5.2. In the long term all the rake tasks will have eager loading disabled and we will give users a mechanism to eager load the tasks they want. We are also going to kill most of the Rake tasks in favor of Rails commands that will respect the configurations.

@rafaelfranca Almiost 2 years since this tiny PR is pending. Though it would be very helpful to have it merged. Are you planning to go through this?

@rafaelfranca rafaelfranca added this to the 6.0.0 milestone Feb 4, 2019

@kaspth kaspth modified the milestones: 6.0.0, 6.1.0 Apr 17, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
10 participants
You can鈥檛 perform that action at this time.