rainbows.git  about / heads / tags
Unicorn for sleepy apps and slow clients
blob 1523c25e413a6456b6a32eb0733ff080e00edd4d 302 bytes (raw)
$ git show v0.97.0:t/fork-sleep.ru	# shows this blob on the CLI

1
2
3
4
5
6
7
8
9
 
# we do not want Rack::Lint or anything to protect us
use Rack::ContentLength
use Rack::ContentType, "text/plain"
trap(:CHLD) { $stderr.puts Process.waitpid2(-1).inspect }
map "/" do
  time = ENV["nr"] || '15'
  pid = fork { exec('sleep', time) }
  run lambda { |env| [ 200, {}, [ "#{pid}\n" ] ] }
end

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