about summary refs log tree commit homepage
path: root/lib/unicorn.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-05-03 16:16:48 -0700
committerEric Wong <normalperson@yhbt.net>2009-05-03 23:29:03 +0000
commitdf76b78d359f34a73ce407f40f594577e04b014b (patch)
treed7d75b2c850760b07b0e65aa0008b781133732f0 /lib/unicorn.rb
parent895ae151c8703ebcd52becf5f2ca297d21274ef6 (diff)
downloadunicorn-df76b78d359f34a73ce407f40f594577e04b014b.tar.gz
Timeouts of less than 2 seconds are unsafe due to the lack of
subsecond resolution in most POSIX filesystems.  This is the
trade-off for using a low-complexity solution for timeouts.
Since this type of timeout is a last resort; 2 seconds is not
entirely unreasonable IMNSHO.  Additionally, timing out too
aggressively can put us in a fork loop and slow down the system.

Of course, the default is 60 seconds and most people do not
bother to change it.
Diffstat (limited to 'lib/unicorn.rb')
-rw-r--r--lib/unicorn.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/unicorn.rb b/lib/unicorn.rb
index f753ea2..2b528fa 100644
--- a/lib/unicorn.rb
+++ b/lib/unicorn.rb
@@ -375,9 +375,8 @@ module Unicorn
     # is stale for >@timeout seconds, then we'll kill the corresponding
     # worker.
     def murder_lazy_workers
-      now = Time.now
       WORKERS.each_pair do |pid, worker|
-        (now - worker.tempfile.ctime) <= @timeout and next
+        Time.now - worker.tempfile.ctime <= @timeout and next
         logger.error "worker=#{worker.nr} PID:#{pid} is too old, killing"
         kill_worker(:KILL, pid) # take no prisoners for @timeout violations
         worker.tempfile.close rescue nil