From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: * X-Spam-ASN: AS33070 50.56.128.0/17 X-Spam-Status: No, score=1.3 required=5.0 tests=AWL,RDNS_NONE,T_DKIM_INVALID shortcircuit=no autolearn=no version=3.3.2 X-Original-To: archivist@yhbt.net Delivered-To: archivist@dcvr.yhbt.net Received: from rubyforge.org (unknown [50.56.192.79]) by dcvr.yhbt.net (Postfix) with ESMTP id B25761F5B6 for ; Sat, 21 Sep 2013 23:38:17 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 2F67E2E18A; Sat, 21 Sep 2013 23:38:18 +0000 (UTC) X-Original-To: mongrel-unicorn@rubyforge.org Delivered-To: mongrel-unicorn@rubyforge.org X-Greylist: delayed 1197 seconds by postgrey-1.31 at rubyforge; Sat, 21 Sep 2013 23:38:10 UTC Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com [209.85.217.172]) by rubyforge.org (Postfix) with ESMTP id EB4562E183 for ; Sat, 21 Sep 2013 23:38:10 +0000 (UTC) Received: by mail-lb0-f172.google.com with SMTP id x18so1659804lbi.31 for ; Sat, 21 Sep 2013 16:38:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=K0j5c6mQ8urKhGDpZG1dyz4fBiT7Bw9BHAXtf5NpkUE=; b=UJx8Sqmfgyie2OmL6RHY5bkkkQkjwCI2zqpjbuM+0bmqVyNaOeo3SO5cLVv+7Blv5y bGK8weB1Frp8vAcnQlsZBwiG68+tIVLYilYvDr3+pppXc7RNY+SWPO7FilKxpgIsKBGt Oo+8o0ssPnoIK0lGuPBb0FaIcptMj9utAPkj5QaZbv7aMkPERZfajPFtxsdDGxtmSYxm DY92kgKhtee4FZWuN/k9BTRhyYjoKvvLRJVb5sxDKUN6vYdLZNbaTNwsZIeF7ef0ot0/ GwE7Min1xgO/BHvOoWA1op/FhkGmHMQihwJZdPNZJABwbF12dEb866yc7bH24P7gtcAf mFLg== X-Received: by 10.112.128.166 with SMTP id np6mr12796712lbb.7.1379805071789; Sat, 21 Sep 2013 16:11:11 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.131.35 with HTTP; Sat, 21 Sep 2013 16:10:51 -0700 (PDT) In-Reply-To: <20130921084911.GA29716@dcvr.yhbt.net> References: <1379713256-23933-1-git-send-email-aman@tmm1.net> <20130921084911.GA29716@dcvr.yhbt.net> From: Aman Gupta Date: Sat, 21 Sep 2013 16:10:51 -0700 X-Google-Sender-Auth: VP4WiU7YnXgQr1Ap43sLiWlzkPU Message-ID: Subject: Re: [PATCH] preload_app can take an optional block for warmup To: Eric Wong Cc: unicorn list 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: mongrel-unicorn-bounces@rubyforge.org Errors-To: mongrel-unicorn-bounces@rubyforge.org > In particular, what benefit does this have over putting the same > code in config.ru or config/initializer.rb (or similar?) With my patch, preload_app yields a rack app object which includes the middleware stack. AFAIK there's no way to do this in the context of config.ru, since the app is still being built. My goal is to warm up the final application that will be serving traffic, including all middleware. On Sat, Sep 21, 2013 at 1:49 AM, Eric Wong wrote: > Aman Gupta wrote: > > Thanks for the patch! > > I expect a commit message body to describe why it is useful. > > In particular, what benefit does this have over putting the same > code in config.ru or config/initializer.rb (or similar?) > > For user-visible config changes like these, it can be similar/identical > to the added documentation. > > Anyways, I agree warming up the app is often necessary, but I'm not > convinced it's necessary change unicorn for it. It makes sense > to warmup apps on servers other than unicorn, too. > >> --- a/lib/unicorn/http_server.rb >> +++ b/lib/unicorn/http_server.rb >> @@ -721,6 +721,9 @@ class Unicorn::HttpServer >> Gem.refresh >> end >> self.app = app.call >> + if preload_app.respond_to?(:call) >> + preload_app[app] >> + end > > Since you're testing for respond_to?(:call), it should be less confusing > to use "preload_app.call(app)" here instead of "preload_app[app]" _______________________________________________ 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