kamisama
kamisama copied to clipboard
Before & After fork hooks
In real applications, we need a way to handle active record connections before & after forking. The master process doesn't need any DB connections.
Without this hook, if you have a rails based background workers, with 10 worker instances, the system will use 11 db connections. 1 for the master process, and 10 for the actual processes.
Example from Unicorn: https://github.com/defunkt/unicorn/blob/master/examples/unicorn.conf.rb#L57