unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: Joseph McDonald <superjoe@gmail.com>
Cc: unicorn list <mongrel-unicorn@rubyforge.org>
Subject: Re: workers created when request comes in?
Date: Tue, 15 Dec 2009 18:37:01 -0800	[thread overview]
Message-ID: <20091216023701.GA6398@dcvr.yhbt.net> (raw)
In-Reply-To: <73096a160912151737t48f6684fhbb5f047bc187c0eb@mail.gmail.com>

Joseph McDonald <superjoe@gmail.com> wrote:
> Is it possible to have unicorn spawn a new worker when a request comes
> in, and only allow that child to service the one request?
> 
> In development mode it would be nice if I could just save my changes
> and know that I will see them right away without having to HUP the
> server.

Hi Joseph,

Yes, just send SIGQUIT to yourself anywhere inside the application
dispatch and it'll defer the exit until your application is done
processing.

You should be able to just make it middleware like this:

  # name inspired by the "shotgun" gem
  class Unicorn::Shotgun < Struct.new(:app)
    def call(env)
      Process.kill(:QUIT, 0)
      app.call(env)
    end
  end

-- 
Eric Wong
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


  reply	other threads:[~2009-12-16  2:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-16  1:37 workers created when request comes in? Joseph McDonald
2009-12-16  2:37 ` Eric Wong [this message]
     [not found]   ` <73096a160912152148l4eea211eq972fcea3ebdf9112@mail.gmail.com>
2009-12-16  6:05     ` 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=20091216023701.GA6398@dcvr.yhbt.net \
    --to=normalperson@yhbt.net \
    --cc=mongrel-unicorn@rubyforge.org \
    --cc=superjoe@gmail.com \
    /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).