unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: "Bráulio Bhavamitra" <braulio@eita.org.br>
To: unicorn-public <unicorn-public@bogomips.org>
Subject: Master hooks needed
Date: Fri, 3 Oct 2014 08:34:37 -0300	[thread overview]
Message-ID: <CAJri6_tdtd5tfPcrTcTBbmQKrmRYnnGJERFwSo1T6PTDsoOO_A@mail.gmail.com> (raw)

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

             reply	other threads:[~2014-10-03 11:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-03 11:34 Bráulio Bhavamitra [this message]
2014-10-03 12:22 ` Master hooks needed 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/unicorn/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJri6_tdtd5tfPcrTcTBbmQKrmRYnnGJERFwSo1T6PTDsoOO_A@mail.gmail.com \
    --to=braulio@eita.org.br \
    --cc=unicorn-public@bogomips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).