about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-11-15 15:13:15 -0800
committerEric Wong <normalperson@yhbt.net>2011-11-15 15:13:15 -0800
commit9e62bc10294f0b6344b47cd596a93ae457d546fb (patch)
tree4442be12f58d18c9f75cee5b997dc8b6a0bf4f90
parentaab850780f9ff0d74c346d7fd62ac588f4d5879b (diff)
downloadunicorn-9e62bc10294f0b6344b47cd596a93ae457d546fb.tar.gz
There's no practical difference between a timeout of 30 days and
68 years from an HTTP server standpoint.

POSIX limits us to 31 days, actually, but there could be
rounding error with floats used in Ruby time calculations and
there's no real difference between 30 and 31 days, either...

Thanks to Jeremy Evans for pointing out large values will throw
EINVAL (on select(2) under OpenBSD with Ruby 1.9.3 and
RangeError on older Rubies.
-rw-r--r--lib/unicorn/configurator.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/unicorn/configurator.rb b/lib/unicorn/configurator.rb
index a93c1dc..89cbf5c 100644
--- a/lib/unicorn/configurator.rb
+++ b/lib/unicorn/configurator.rb
@@ -188,7 +188,8 @@ class Unicorn::Configurator
   #    }
   def timeout(seconds)
     set_int(:timeout, seconds, 3)
-    max = 0x7ffffffe # Rainbows! adds one second to this for safety
+    # POSIX says 31 days is the smallest allowed maximum timeout for select()
+    max = 30 * 60 * 60 * 24
     set[:timeout] = seconds > max ? max : seconds
   end