[英]Rails server takes a long time to start up
I was working on a Rails project, but while I wasn't paying attention my computer battery died while the rails server was still running. 我正在开发一个Rails项目,但是当我没有注意时,我的计算机电池在rails服务器仍在运行时死机。
Now when I type rails s
, the rails server takes a very very long time to start up. 现在当我输入
rails s
,rails服务器需要很长时间才能启动。 I timed it at about 40 seconds. 我在大约40秒时计时。 It did not take this long before.
这件事早就没过了。
I tried looking up other answers, but nothing really worked. 我试着查找其他答案,但没有真正奏效。
Any help is appreciated, thanks. 任何帮助表示赞赏,谢谢。
I'm running a 2010 Macbook Pro, Rails 4.2.0 我正在运行2010 Macbook Pro,Rails 4.2.0
You can turn eager_loading and cache_control false and then it will take few seconds to start server 您可以将eager_loading和cache_control设置为false,然后启动服务器将需要几秒钟
Note: By turning cache_control to false will gradually increase server boot up time ( in development environment ) as you don't need to restart webserver when you make changes in code. 注意:通过将cache_control设置为false将逐渐增加服务器启动时间( 在开发环境中 ),因为在代码中进行更改时不需要重新启动Web服务器。 By turning eager_load to false will increase server boot up time from 2 minutes to 10 seconds but can cause inconsistency so use it wisely.
通过将eager_load设置为false将服务器启动时间从2分钟增加到10秒,但可能会导致不一致,因此请明智地使用它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.