about summary refs log tree commit homepage
path: root/lib/mogilefs/backend.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mogilefs/backend.rb')
-rw-r--r--lib/mogilefs/backend.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/mogilefs/backend.rb b/lib/mogilefs/backend.rb
index 48f3a2e..01203f6 100644
--- a/lib/mogilefs/backend.rb
+++ b/lib/mogilefs/backend.rb
@@ -147,7 +147,7 @@ class MogileFS::Backend
       tries ||= Hash.new { |hash,host| hash[host] = 0 }
       nr = tries[@active_host] += 1
       if nr >= 2
-        @dead[@active_host] = [ Time.now, err ]
+        @dead[@active_host] = [ MogileFS.now, err ]
       end
       shutdown_unlocked
       retry
@@ -163,7 +163,7 @@ class MogileFS::Backend
   end
 
   def timeout_update(timeout, t0) # :nodoc:
-    timeout -= (Time.now - t0)
+    timeout -= (MogileFS.now - t0)
     timeout < 0 ? 0 : timeout
   end
 
@@ -174,12 +174,12 @@ class MogileFS::Backend
   def pipeline_drain_unlocked(io, timeout) # :nodoc:
     set = [ io ]
     while @pending.size > 0
-      t0 = Time.now
+      t0 = MogileFS.now
       r = IO.select(set, set, nil, timeout)
       timeout = timeout_update(timeout, t0)
 
       if r && r[0][0]
-        t0 = Time.now
+        t0 = MogileFS.now
         pipeline_gets_unlocked(io, timeout)
         timeout = timeout_update(timeout, t0)
       else
@@ -207,7 +207,7 @@ class MogileFS::Backend
         io.timed_write(request, timeout)
         @pending << [ request, block ]
       rescue SystemCallError, MogileFS::RequestTruncatedError => err
-        @dead[@active_host] = [ Time.now, err ]
+        @dead[@active_host] = [ MogileFS.now, err ]
         shutdown_unlocked(@pending[0])
         io = socket
         retry
@@ -343,14 +343,14 @@ class MogileFS::Backend
     return @socket if @socket and not @socket.closed?
 
     @hosts.shuffle.each do |host|
-      next if dead = @dead[host] and dead[0] > (Time.now - @fail_timeout)
+      next if dead = @dead[host] and dead[0] > (MogileFS.now - @fail_timeout)
 
       begin
         addr, port = host.split(/:/)
         @socket = MogileFS::Socket.tcp(addr, port, @timeout)
         @active_host = host
       rescue SystemCallError, MogileFS::Timeout => err
-        @dead[host] = [ Time.now, err ]
+        @dead[host] = [ MogileFS.now, err ]
         next
       end