I have got my resque setup process complete, tested successfully with a simple job. It is recommended to close ActiveRecord connection in the pool setup rake task and establish the connection on
after_prefork to avoid stale connections before forking.
I now need to do this for mongoid, I can establish the connection by doing
Mongoid.load! 'path_to_mongoid.yml' but I can't seem to find a way to close the connection, I tried
disconnect, close methods but I don't know if they get reconnected or if it doesn't kill off the connection. I tried this in a rails console, I was able to test it with ActiveRecord doesn't work with mongoid.
It looks like
disconnect does actually kills off the mongoid connection, I was getting confused because I was expecting an similar error I got when I tried out with active record but looks like mongoid autoconnects when needed.
I verified that the connection was killed using mongo console, you can do a
db.serverStatus().connections to view the number of connections and see that disconnect will decrease the current connections.