On Wed, Sep 23, 2015 at 5:31 PM, Eric Wong <e...@80x24.org> wrote:
> "Lin Jen-Shin (godfat)" <god...@godfat.org> 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.
--
unsubscribe: yahns-public+unsubscr...@yhbt.net
archive: http://yhbt.net/yahns-public/

Reply via email to