-
Notifications
You must be signed in to change notification settings - Fork 755
Triggering Sprockets on Rails init #249
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This causes extreme app bootup times. When hosted on Heroku which has a 60s timeout for app boot you can get yourself into some trouble after a server reboot where your servers are marked as crashed and no requests are processed. I find the app boot time to be right around 60s and it basically makes deploying to heroku a complete crapshoot on whether or not your app will boot back up. |
We've just removed this gem from our app altogether… |
Thanks for your detailed report & info about how to measure the issue. This is new turf for me! Looks like this was resolved by #253, here's a comparison of
1.0Lots of Sprockets
masterNow with 20x less Sprockets :P
Looks good to me, does that look good to you? I'll cut |
I tried using the current version on master, but I'm receiving the following error during bootup.
It seems like this was encountered in the past according to #31 |
Oh i see it's here, I imagine it's a sprockets 2.12 thing. I thought one of the Appraisals ran Sprockets 2 but I guess not. Looking now... |
btw what rake task was that? |
Yeah, I think the Rails 3.1 Appraisal uses Sprockets 2, eg this job |
rake db:test:prepare Other rake tasks appear to work just fine though and my server boots up just fine, so it appears it's something to do with that rake task and possibly running under the TEST environment |
Ah, I reproduced also with Also:
I guess we should either test Sprockets version or make a dependency on Sprockets 3. But Sprockets 3 is really new (released April 12, 2015), so I don't think we should add that dependency. I'm surprised the tests passed! Paging @byroot , I guess you were running Sprockets 3? |
I wasn't using sprockets 3 AFAIK. I'll try to take a look at this issue during the week end. |
Unfortunately the compass-rails gem forces Sprockets < 2.13 and lots of front-end gems tend to depend on compass-rails so I'm stuck with using Sprockets 2.13 for the time being, at least until Compass/compass-rails#227 is finished and merged. At least the server bootup times are much quicker now, thanks for the work on this 👍 |
yeah forcing sprockets 3 is not realistic before a year or 2. But don't worry I'm fairly certain this can be fixed. |
Ok, so I'm kinda stupid: https://github.com/rails/sprockets-rails/blob/627db8302914666ee212c823e50ed3bc1fc4a8f8/lib/sprockets/railtie.rb#L116-L118
Unfortunately we can't do it in It look like doing from a regular initializer work, but I'm not 100% sure. @mchristen could you please test this branch: #267 ? |
I just tested your branch @byroot and that particular issue is fixed, all rake tasks I've tested seem to work fine now, thanks! Now I'm running into an entirely separate issue related to the decoupled ServerRendering code, I'll make a comment on that pull request with some details. |
thanks for testing, glad this is cleared up! |
Whilst trying to reduce our app boot time and memory I noticed Sprockets extension name parsing was being triggered on Rails app load.
I added a
raise
insideSprockets#extname_map
that is causing all this, and the only place it's called during Rails init is from this part of railtie.rb:Removing
react-rails
from the Gemfile brings things back to normal (extname
is never called):So
config.react.react_js
is called from in theconfig.after_initialize
like so:Is there a way to avoid this call to
::Rails.application.assets.resolve('react.js')
incfg.react_js
?The text was updated successfully, but these errors were encountered: