rainbows.git  about / heads / tags
Unicorn for sleepy apps and slow clients
blob 90dc6c5380f0ea1bb8f41f4f4961c4cef7d82167 343 bytes (raw)
$ git show v0.3.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
 
# 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
    ::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