diff options
author | Eric Wong <e@80x24.org> | 2015-02-05 20:46:14 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-02-05 20:46:14 +0000 |
commit | eb90ff89627a9001ae224f542e75919dc6fd96c9 (patch) | |
tree | feeb68eaff34250b3e553a2ec87f478d6e75e822 /lib/yahns/server.rb | |
parent | 8df14c20ad4f0b4ec9814ba858edd7e2f5a7ca72 (diff) | |
download | yahns-eb90ff89627a9001ae224f542e75919dc6fd96c9.tar.gz |
The monotonic clock is immune to time adjustments so it is not thrown off by misconfigured clocks. Process.clock_gettime also generates less garbage on 64-bit systems due to the use of Flonum.
Diffstat (limited to 'lib/yahns/server.rb')
-rw-r--r-- | lib/yahns/server.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/yahns/server.rb b/lib/yahns/server.rb index e05a0e4..3b9addc 100644 --- a/lib/yahns/server.rb +++ b/lib/yahns/server.rb @@ -385,7 +385,7 @@ class Yahns::Server # :nodoc: def quit_enter(alive) if alive @logger.info("gracefully exiting shutdown_timeout=#@shutdown_timeout") - @shutdown_expire ||= Time.now + @shutdown_timeout + 1 + @shutdown_expire ||= Yahns.now + @shutdown_timeout + 1 else # drop connections immediately if signaled twice @logger.info("graceful exit aborted, exiting immediately") # we will still call any app-defined at_exit hooks here @@ -416,7 +416,7 @@ class Yahns::Server # :nodoc: # response bodies out (e.g. "tail -F") Oh well, have a timeout begin @wthr.delete_if { |t| t.join(0.01) } - end while @wthr[0] && Time.now <= @shutdown_expire + end while @wthr[0] && Yahns.now <= @shutdown_expire # cleanup, our job is done @queues.each(&:close).clear @@ -466,7 +466,7 @@ class Yahns::Server # :nodoc: def dropping(fdmap) if drop_acceptors[0] || fdmap.size > 0 - timeout = @shutdown_expire < Time.now ? -1 : @shutdown_timeout + timeout = @shutdown_expire < Yahns.now ? -1 : @shutdown_timeout fdmap.desperate_expire(timeout) true else |