Created
October 29, 2010 21:01
-
-
Save jkvor/654395 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Bench | |
def counter | |
@@counter ||= 0 | |
end | |
def call(env) | |
STDOUT.puts "beginning request #{counter}" | |
sleep 45 if env['PATH_INFO'] == '/timeout' | |
body = 'OK' | |
headers = { | |
'Content-Type' => 'text/html; charset=utf-8', | |
'Content-Length' => body.size.to_s, | |
'Cache-Control' => 'private, no-store' | |
} | |
STDOUT.puts "finished request #{counter}" | |
@@counter += 1 | |
[200, headers, [body]] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment