Why does Heroku re-compile my assets after the application has been idle for a while?

自闭症网瘾萝莉.ら 提交于 2019-12-11 13:46:53

问题


In production (on Heroku), shouldn't the assets be compiled on bootup one time, and then never compiled again?

/production.rb
config.serve_static_assets = false
config.assets.compress = true
config.assets.compile = false
config.assets.digest = true

When someone doesnt hit my application for a while things go idle, and it seems that the assets are re-compiled when that new, fresh request comes in???

Any idea what im doing wrong?


回答1:


On Heroku, if your application is idle for an hour, the dynos will go into standby. That's why when you revisit your application it takes a bit to load the first time. You mention "bootup" time - that's exactly what's happening once your dynos reboot, your instance does not continuously run once you push.

When the dynos are coming back to life, your assets will need to precompile, since you have config.assets.compile set to false. This behavior really isn't out of the ordinary.

If you want to avoid that, you can set a cron job to curl your heroku instance every half hour.



来源:https://stackoverflow.com/questions/10871696/why-does-heroku-re-compile-my-assets-after-the-application-has-been-idle-for-a-w

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!