about summary refs log tree commit homepage
path: root/t/heartbeat-timeout.ru
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-10-30 18:14:37 -0700
committerEric Wong <normalperson@yhbt.net>2009-10-30 18:14:37 -0700
commitb96822f15c9ede2a0053afeb1a5f43d3df7d7d3d (patch)
tree15be0d666a48ebd0e82e9fd8e0245195d6d9faf9 /t/heartbeat-timeout.ru
parentf7189b5074ea99519a2a005c8b0f369bc1fd3a39 (diff)
downloadrainbows-b96822f15c9ede2a0053afeb1a5f43d3df7d7d3d.tar.gz
This module will be reused in upcoming Rev-derived concurrency
models.
Diffstat (limited to 't/heartbeat-timeout.ru')
-rw-r--r--t/heartbeat-timeout.ru13
1 files changed, 13 insertions, 0 deletions
diff --git a/t/heartbeat-timeout.ru b/t/heartbeat-timeout.ru
new file mode 100644
index 0000000..fff0c40
--- /dev/null
+++ b/t/heartbeat-timeout.ru
@@ -0,0 +1,13 @@
+use Rack::ContentLength
+fifo = ENV['FIFO_PATH'] or abort "FIFO_PATH not defined"
+headers = { 'Content-Type' => 'text/plain' }
+run lambda { |env|
+  case env['PATH_INFO']
+  when "/block-forever"
+    # this should block forever (or until somebody opens it for reading)
+    File.open(fifo, "rb") { |fp| fp.syswrite("NEVER\n") }
+    [ 500, headers, [ "Should never get here\n" ] ]
+  else
+    [ 200, headers, [ "#$$\n" ] ]
+  end
+}