Joe Williams <[email protected]> wrote:
> I am attempting to do something like the following:
>
> after_fork do |server, worker|
> $unicorn_uptime = Time.now.to_i.to_s
> $unicorn_uptime.freeze
> <snip>
>
> Unfortunately the variable comes up nil when later accessed. Anyone have
> thoughts on what I am missing?
I tried your after_fork hook with the following config.ru
and it prints out $unicorn_uptime fine:
-------------------- config.ru --------------------------
use Rack::ContentLength
use Rack::ContentType, 'text/plain'
run lambda { |env| [ 200, {}, [ "#$unicorn_uptime\n"] ] }
---------------------------------------------------------
Perhaps you have something else in your app clobbering globals?
Also, please don't send any HTML parts in mail, it is spammy and wastes
bandwidth/storage. Your message would've been seen much sooner if it
hadn't been flagged as spam. Thanks.