Diagnosing the cause of slow view rendering

前端 未结 5 1521
滥情空心
滥情空心 2020-12-04 08:29

I\'m not sure when this started, but something unusual is happening in my app (run locally on a development machine). Suddenly I am seeing messages like:

Sta         


        
5条回答
  •  日久生厌
    2020-12-04 08:52

    Ok, I figured it out (at long last). Without changing any of my actual assets I am now seeing this is development:

    Started GET "/" for 127.0.0.1 at 2013-03-11 23:14:33 +1300
    Processing by PagesController#home as HTML
    Rendered pages/home.html.erb within layouts/application (1.3ms)
    

    It turns out the delay was being caused by config.assets.debug = true inside of development.rb. Setting this to false resolves the problem.

    Looks like the Rails core team debated turning this off by default, but decided against the idea. In the future I'd love to see them put something in the comment section of development.rb to tip off users of the potential for significant delays.

    May I suggest the following:

    # Expands the lines which load the assets 
    # May cause significant delays in view rendering
    

    Great, they heard me muttering and updated rails!

提交回复
热议问题