'before_fork' is executed in parallel by two processes ¿?
Iñaki Baz Castillo
ibc at aliax.net
Tue Jan 5 19:33:05 EST 2010
El Miércoles, 6 de Enero de 2010, Eric Wong escribió:
> 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
So if I'm not wrong when before_fork block is runned the $stderr is already
redirected to the IO set in "stderr_path", rigth?
Then any error in the config file into before_fork would not vi raised to the
terminal screen but to the stderr (if it has been redirected).
Then I see no advantage on using what you suggest ("if worker.nr == 0 ...")
over adding such code at the top of the config file. Do I miss something?
Thanks a lot.
Iñaki Baz Castillo <ibc at aliax.net>
More information about the mongrel-unicorn