about summary refs log tree commit homepage
path: root/t/t9101.ru
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-08-18 23:59:21 -0700
committerEric Wong <normalperson@yhbt.net>2010-08-19 00:27:15 -0700
commitbd3ed0b04f826b20cce83f9b77fc13c0eefd3902 (patch)
tree8b1065a10ae2e3e44bfe04edc868946e603adfc7 /t/t9101.ru
parentac05e7035e1946b78ce4679548db7680aa01734c (diff)
downloadrainbows-bd3ed0b04f826b20cce83f9b77fc13c0eefd3902.tar.gz
This allows for per-dispatch timeouts similar to (but not exactly)
the way Mongrel (1.1.x) implemented them with threads.
Diffstat (limited to 't/t9101.ru')
-rw-r--r--t/t9101.ru9
1 files changed, 9 insertions, 0 deletions
diff --git a/t/t9101.ru b/t/t9101.ru
new file mode 100644
index 0000000..ee20085
--- /dev/null
+++ b/t/t9101.ru
@@ -0,0 +1,9 @@
+use Rack::ContentLength
+use Rack::ContentType, 'text/plain'
+use Rainbows::ThreadTimeout, :timeout => 1, :threshold => -1
+run lambda { |env|
+  if env["PATH_INFO"] =~ %r{/([\d\.]+)\z}
+    Rainbows.sleep($1.to_f)
+  end
+  [ 200, [], [ "HI\n" ] ]
+}