From 0a10915fff80ff90bdef2a905dfdc589e815aefd Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 18 Nov 2015 03:58:05 +0000 Subject: bump to unicorn 5.0.1, use monotonic clock The timeout (mis)feature in unicorn uses the monotonic clock if available. We must follow suit to avoid having our timeout functionality completely broken. --- lib/rainbows/fiber/base.rb | 4 ++-- lib/rainbows/fiber/coolio/heartbeat.rb | 2 +- lib/rainbows/fiber/io.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/rainbows/fiber') diff --git a/lib/rainbows/fiber/base.rb b/lib/rainbows/fiber/base.rb index e8f5b16..7c4fb59 100644 --- a/lib/rainbows/fiber/base.rb +++ b/lib/rainbows/fiber/base.rb @@ -40,7 +40,7 @@ module Rainbows::Fiber::Base # woken and returns an interval to IO.select on def schedule_sleepers max = nil - now = Time.now + now = Rainbows.now fibs = [] ZZ.delete_if { |fib, time| if now >= time @@ -54,7 +54,7 @@ module Rainbows::Fiber::Base max_sleep = 1.0 # wake up semi-frequently to prevent SIGKILL from master if max - max -= Time.now + max -= Rainbows.now return 0 if max < 0.0 return max_sleep if max > max_sleep max diff --git a/lib/rainbows/fiber/coolio/heartbeat.rb b/lib/rainbows/fiber/coolio/heartbeat.rb index 6b1e4f9..7014dbe 100644 --- a/lib/rainbows/fiber/coolio/heartbeat.rb +++ b/lib/rainbows/fiber/coolio/heartbeat.rb @@ -5,7 +5,7 @@ class Rainbows::Fiber::Coolio::Heartbeat < Coolio::TimerWatcher ZZ = Rainbows::Fiber::ZZ def on_timer exit if (! Rainbows.tick && Rainbows.cur <= 0) - now = Time.now + now = Rainbows.now fibs = [] ZZ.delete_if { |fib, time| now >= time ? fibs << fib : ! fib.alive? } fibs.each { |fib| fib.resume if fib.alive? } diff --git a/lib/rainbows/fiber/io.rb b/lib/rainbows/fiber/io.rb index b121854..111132f 100644 --- a/lib/rainbows/fiber/io.rb +++ b/lib/rainbows/fiber/io.rb @@ -63,7 +63,7 @@ class Rainbows::Fiber::IO expire = nil case rv = Kgio.tryread(@to_io, 16384, buf) when :wait_readable - return if expire && expire < Time.now + return if expire && expire < Rainbows.now expire ||= read_expire kgio_wait_readable else -- cgit v1.2.3-24-ge0c7