'before_fork' is executed in parallel by two processes ¿?

Eric Wong normalperson at yhbt.net
Tue Jan 5 18:55:52 EST 2010

Iñaki Baz Castillo <ibc at aliax.net> wrote:
> El Martes, 5 de Enero de 2010, Eric Wong escribió:
> > Yes, before_fork and after_fork are both called for every worker forked.
> So if I just want to test a DB connection then I do better wrtitting such code 
> out of before_fork in the config file, right? (at least it's the workaround 
> that works for me).

You can also do it on a certain worker only:

  before_fork do |server, worker|
    if worker.nr == 0

Eric Wong

More information about the mongrel-unicorn mailing list