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: mongrel-unicorn@rubyforge.org
Subject: Re: workers created when request comes in?
Date: Wed, 16 Dec 2009 06:05:39 +0000	[thread overview]
Message-ID: <20091216060539.GB1654@dcvr.yhbt.net> (raw)
In-Reply-To: <73096a160912152148l4eea211eq972fcea3ebdf9112@mail.gmail.com>

Joseph McDonald <superjoe@gmail.com> wrote:
> On Tue, Dec 15, 2009 at 6:37 PM, Eric Wong <normalperson@yhbt.net> wrote:
> 
> > 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)
                             ^-- Oops, that should be a $$, not 0
> >      app.call(env)
> >    end
> >  end
> 
> Thanks Eric,
> I added that middleware, but now unicorn exits after servicing one
> request.  I'd like unicorn to keep running and fork off a new child if
> a new request comes in.  Is that possible?

Yeah, just change the 0 to a $$ there, brain fart :x

With that middleware, it should prefork a worker, but then kill it
after every request (and a new one will be preforked).

-- 
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


      parent reply	other threads:[~2009-12-16  6:40 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
     [not found]   ` <73096a160912152148l4eea211eq972fcea3ebdf9112@mail.gmail.com>
2009-12-16  6:05     ` Eric Wong [this message]

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=20091216060539.GB1654@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).