unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* Master hooks needed
@ 2014-10-03 11:34 Bráulio Bhavamitra
  2014-10-03 12:22 ` Eric Wong
  0 siblings, 1 reply; 11+ messages in thread
From: Bráulio Bhavamitra @ 2014-10-03 11:34 UTC (permalink / raw)
  To: unicorn-public

Hello all,

If I need to hook something after master load, I'm currently doing:

before_fork do |server, worker|
  # worker 0 is the first to init, so hold the master here
  if worker.nr == 0
     #warm up server...

     #kill old pid...
  end

  # other stuff for each worker
end

Both operations I currently do (server warm up and old pid kill) need
to be run only once, and not for every worker as before_fork does,
that's why I had to put the condition seen above.

So hooks for master is needed, something like
master_after_load(server) and master_init(server).

What do you think?

cheers,
bráulio

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-10-04  2:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-03 11:34 Master hooks needed Bráulio Bhavamitra
2014-10-03 12:22 ` Eric Wong
2014-10-03 12:36   ` Valentin Mihov
2014-10-03 17:50     ` Eric Wong
2014-10-03 18:12       ` Valentin Mihov
2014-10-04  0:53   ` Bráulio Bhavamitra
2014-10-04  1:22     ` Eric Wong
2014-10-04  1:35       ` Bráulio Bhavamitra
2014-10-04  1:57         ` Eric Wong
2014-10-04  2:04           ` Bráulio Bhavamitra
2014-10-04  2:25             ` Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).