rainbows.git  about / heads / tags
Unicorn for sleepy apps and slow clients
blob 471bddc070a50a97e6e0765c851298ce63326542 422 bytes (raw)
$ git show v0.5.0:t/heartbeat-timeout.ru	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
 
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"
    # one of these should block forever
    Process.kill(:STOP, $$)
    ::File.open(fifo, "rb") { |fp| fp.syswrite("NEVER\n") }
    [ 500, headers, [ "Should never get here\n" ] ]
  else
    [ 200, headers, [ "#$$\n" ] ]
  end
}

git clone https://yhbt.net/rainbows.git