Skip to content

Instantly share code, notes, and snippets.

@jkvor
Created October 29, 2010 21:01
Show Gist options
  • Save jkvor/654395 to your computer and use it in GitHub Desktop.
Save jkvor/654395 to your computer and use it in GitHub Desktop.
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