Rails:页面加载时间很长 [英] Rails: Page loading very long time
问题描述
我有一个Rails项目. 我在一个控制器中遇到了一件很奇怪的事情:浏览器需要大约3分钟才能加载页面,但是Rails会在日志中写入:
I have a rails project. I got very strange thing in one controller: browser needs about 3 minutes for load page but Rails writes in logs:
Completed 200 OK in 20563ms (Views: 17144.2ms | ActiveRecord: 324.4ms)
我知道这是很长的时间21秒,但不是3分钟.
I know 21 sec it's very long time, but It's not 3 minutes.
我知道这些数据还不够,但是我不希望仅在出现问题的指针时才能完整回答. 此页面的大小约为5 Mb.
I know this data not enough but I don't expect complete answer only a pointer where is trouble. Size of this page about 5 Mb.
推荐答案
延迟可能是由于config/environments/development.rb
内部的config.assets.debug = true
引起的.将此设置为false
可能会解决您的问题.
The delay might be caused by config.assets.debug = true
inside of config/environments/development.rb
. Setting this to false
may resolve your problem.
这样做,源文件将合并在一起,而源地图将不会 工作(例如,如果使用Sass/Coffee,则不会在devtools中看到它)
By doing this,source files are combined together and source maps won't work (e.g. if using Sass/Coffee you won't see it in devtools)
这篇关于Rails:页面加载时间很长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!