Rails, Mongoid & Unicorn config for Heroku

落爺英雄遲暮 提交于 2019-12-03 09:24:54

You dont actually need to do this, so for people coming to view this question see:

http://mongoid.org/en/mongoid/docs/rails.html

"Unicorn and Passenger

When using Unicorn or Passenger, each time a child process is forked when using app preloading or smart spawning, Mongoid will automatically reconnect to the master database. If you are doing this in your application manually you may remove your code."

Though it would still be interesting to know what would be the equivalent Mongoid code.

What about ::Mongoid.default_session.connect ::Mongoid.default_session.disconnect

https://docs.mongodb.com/mongoid/current/tutorials/mongoid-configuration/#usage-with-forking-servers

The documentation on mongodb.com says that after_fork and before_fork for unicorn or passenger are required.

This probably changed recently. This is the 7.0 mongoid documentation

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