From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS14383 205.234.109.0/24 X-Spam-Status: No, score=-0.5 required=5.0 tests=AWL,MSGID_FROM_MTA_HEADER, RP_MATCHES_RCVD shortcircuit=no autolearn=unavailable version=3.3.2 Path: news.gmane.org!not-for-mail From: Eric Wong Newsgroups: gmane.comp.lang.ruby.unicorn.general Subject: Re: workers created when request comes in? Date: Wed, 16 Dec 2009 06:05:39 +0000 Message-ID: <20091216060539.GB1654@dcvr.yhbt.net> References: <73096a160912151737t48f6684fhbb5f047bc187c0eb@mail.gmail.com> <20091216023701.GA6398@dcvr.yhbt.net> <73096a160912152148l4eea211eq972fcea3ebdf9112@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1260945647 16404 80.91.229.12 (16 Dec 2009 06:40:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 16 Dec 2009 06:40:47 +0000 (UTC) Cc: mongrel-unicorn@rubyforge.org To: Joseph McDonald Original-X-From: mongrel-unicorn-bounces@rubyforge.org Wed Dec 16 07:40:40 2009 Return-path: Envelope-to: gclrug-mongrel-unicorn@m.gmane.org X-Original-To: mongrel-unicorn@rubyforge.org Delivered-To: mongrel-unicorn@rubyforge.org Content-Disposition: inline In-Reply-To: <73096a160912152148l4eea211eq972fcea3ebdf9112@mail.gmail.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-BeenThere: mongrel-unicorn@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: mongrel-unicorn-bounces@rubyforge.org Errors-To: mongrel-unicorn-bounces@rubyforge.org Xref: news.gmane.org gmane.comp.lang.ruby.unicorn.general:220 Archived-At: Received: from rubyforge.org ([205.234.109.19]) by lo.gmane.org with esmtp (Exim 4.50) id 1NKnYu-0001Ll-7I for gclrug-mongrel-unicorn@m.gmane.org; Wed, 16 Dec 2009 07:40:40 +0100 Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 0768A1858304; Wed, 16 Dec 2009 01:40:40 -0500 (EST) Received: from dcvr.yhbt.net (dcvr.yhbt.net [64.71.152.64]) by rubyforge.org (Postfix) with ESMTP id 3B0B118582DE for ; Wed, 16 Dec 2009 01:05:41 -0500 (EST) Received: from localhost (dcvr.yhbt.net [127.0.0.1]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPSA id A5B6E1F50A; Wed, 16 Dec 2009 06:05:40 +0000 (UTC) Joseph McDonald wrote: > On Tue, Dec 15, 2009 at 6:37 PM, Eric Wong 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: > > > > =A0# name inspired by the "shotgun" gem > > =A0class Unicorn::Shotgun < Struct.new(:app) > > =A0 =A0def call(env) > > =A0 =A0 =A0Process.kill(:QUIT, 0) ^-- Oops, that should be a $$, not 0 > > =A0 =A0 =A0app.call(env) > > =A0 =A0end > > =A0end > = > 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