rainbows.git  about / heads / tags
Unicorn for sleepy apps and slow clients
blob af6b4fcd4579609b30ee859bd7617ab84865fcaf 430 bytes (raw)
$ git show v0.3.0:t/t9000.ru	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
 
use Rack::ContentLength
use Rack::ContentType
use Rainbows::AppPool, :size => ENV['APP_POOL_SIZE'].to_i
sleep_class = ENV['SLEEP_CLASS']
sleep_class = sleep_class ? Object.const_get(sleep_class) : Kernel
class Sleeper
  def call(env)
    sleep_class = ENV['SLEEP_CLASS']
    sleep_class = sleep_class ? Object.const_get(sleep_class) : Kernel
    sleep_class.sleep 1
    [ 200, {}, [ "#{object_id}\n" ] ]
  end
end
run Sleeper.new

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