rainbows.git  about / heads / tags
Unicorn for sleepy apps and slow clients
blob 84163c1022ae6a0c7b60217dd2f4b5222cf2f960 382 bytes (raw)
$ git show v0.97.0:t/large-file-response.ru	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
 
# lib-large-file-response will stop running if we're not on Linux here
use Rack::ContentLength
use Rack::ContentType
map "/rss" do
  run lambda { |env|
    # on Linux, this is in kilobytes
    GC.start if GC.respond_to?(:start)
    ::File.read("/proc/self/status") =~ /^VmRSS:\s+(\d+)/
    [ 200, {}, [ ($1.to_i * 1024).to_s ] ]
  }
end
map "/" do
  run Rack::File.new(Dir.pwd)
end

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