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=0.5 required=5.0 tests=AWL,RDNS_NONE 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 7AEAA1F700 for ; Sat, 21 Sep 2013 08:49:19 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 6360B2E18C; Sat, 21 Sep 2013 08:49:19 +0000 (UTC) X-Original-To: mongrel-unicorn@rubyforge.org Delivered-To: mongrel-unicorn@rubyforge.org Received: from dcvr.yhbt.net (dcvr.yhbt.net [64.71.152.64]) by rubyforge.org (Postfix) with ESMTP id DD9EB2E18C for ; Sat, 21 Sep 2013 08:49:12 +0000 (UTC) Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 60A481F6FB; Sat, 21 Sep 2013 08:49:11 +0000 (UTC) Date: Sat, 21 Sep 2013 08:49:11 +0000 From: Eric Wong To: unicorn list Subject: Re: [PATCH] preload_app can take an optional block for warmup Message-ID: <20130921084911.GA29716@dcvr.yhbt.net> References: <1379713256-23933-1-git-send-email-aman@tmm1.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1379713256-23933-1-git-send-email-aman@tmm1.net> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Aman Gupta 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 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