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: AS15169 209.85.128.0/17 X-Spam-Status: No, score=-1.2 required=3.0 tests=AWL,BAYES_00,URIBL_BLOCKED shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: yahns-public@yhbt.net Received: from mail-io0-f176.google.com (mail-io0-f176.google.com [209.85.223.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 64617200F8 for ; Wed, 23 Sep 2015 09:50:29 +0000 (UTC) Received: by iofh134 with SMTP id h134so38948468iof.0 for ; Wed, 23 Sep 2015 02:50:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=nf/iBdvXt6W+lI1H2Tl4ZSDTas7T5/r876JIRj5nllk=; b=J5mamJV3kZwSYITFLvdF53XSZe5FrcUH6OrARtMG3OWj51JIc17yH2JFvQeVWE2Ci3 ebzr17HpIfOF5ONCBw1TGN7he46g1DxEhIFpWdbNmTFJbrjhq7huCjXNZGIDeJl1iyIW 2VvGaGieDtYl/wqmvUgA1vgj2w4yoQ4heztYJldOAfVt5/AzeKySi9rDHuG7eopObKsr AEpn8PONwv7P6qoLwKXKJAEeipjUbF6q/lYR7mqRMG9z2l7sGdcWYq96FE6+2MewTeG2 j+Avc73JRwNKkGCM4zOPFV9uz04qlpVWWyEFnwlCfFyb37439NCLfU6R6VXFECcSftTS bYBA== X-Gm-Message-State: ALoCoQkhE4T0xxxsATBMCeb9e8VOrkkr8DDyKFM82f8W9ftQH+wRBBofvggRb94qEf1FZsPNyjkG X-Received: by 10.107.35.20 with SMTP id j20mr34611231ioj.39.1443001828576; Wed, 23 Sep 2015 02:50:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.30.13 with HTTP; Wed, 23 Sep 2015 02:49:59 -0700 (PDT) In-Reply-To: <20150923093103.GA23550@dcvr.yhbt.net> References: <20150923080504.GA19141@dcvr.yhbt.net> <20150923083025.GA22196@dcvr.yhbt.net> <20150923093103.GA23550@dcvr.yhbt.net> From: "Lin Jen-Shin (godfat)" Date: Wed, 23 Sep 2015 17:49:59 +0800 Message-ID: Subject: Re: -1 shutdown_timeout? To: Eric Wong Cc: yahns-public@yhbt.net Content-Type: text/plain; charset=UTF-8 List-Id: On Wed, Sep 23, 2015 at 5:31 PM, Eric Wong wrote: > "Lin Jen-Shin (godfat)" wrote: >> Just tried it, but not sure where to put this. >> With preload=true, yahns is trapping later than >> the application. Maybe I should just set it to false >> since we're not forking anyway... > > Anywhere in your normal app dispatch path, just initialize the > lock during application load (regardless of preload value) > > def initialize(...) > @lock = Mutex.new > @old_quit = nil > end > > def call(env) > unless @old_quit > @lock.synchronize do > @old_quit ||= trap(:QUIT) do > app_specific_quit > @old_quit.call > end > end > end > ... > end Oh, I really hope we don't have to initialize/load anything during processing requests. But I guess this is the only way to make sure this is compatible between different servers... :( I really hope rack warmup were implemented the other way so that we could initialize this while warming up... Like the server should be calling it before serving request, rather than at the time application was loaded.