El Martes, 5 de Enero de 2010, Iñaki Baz Castillo escribió:
> Hi, by adding `echo $$ >> /tmp/kk` into 'before_fork' I've realized that
> two pids are printed to the file when starting Unicorn.
> This means that 'before_fork' is being runned by two different processes in
> parallel. Is it the expected behaviour? perhaps something very wrong in my
> configuration?
I've totally lost. before_fork is executed in parallel by the number of
workers set in the "worker_processes". I've tested the following:
before_fork do |server, worker|
`echo "before_fork $$" >> /tmp/kk`
end
after_fork do |server, worker|
`echo "after_fork $$" >> /tmp/kk`
end
And this is the file output:
before_fork 3447
after_fork 3456
before_fork 3454
before_fork 3463
after_fork 3464
after_fork 3472
Could I know what is happening please? This really breaks the concept I had.
In fact I use before_fork to check database connections and so, but I've
realized that such check if done N (number of workers).
Thanks for any help.
--
Iñaki Baz Castillo <[email protected]>
_______________________________________________
Unicorn mailing list - [email protected]
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying