Skip to content

Instantly share code, notes, and snippets.

@eric1234
Created October 22, 2010 16:35
Show Gist options
  • Save eric1234/640907 to your computer and use it in GitHub Desktop.
Save eric1234/640907 to your computer and use it in GitHub Desktop.
Will continuously ping a heroku to see if we get any long delays
#!/usr/bin/env ruby
$VERBOSE = true
require 'net/http'
require 'benchmark'
loop do
delay = Benchmark.realtime do
message = Net::HTTP.get('delay.heroku.com', '/') rescue nil
puts "Instead of ping got: #{message}" unless message == "ping\n"
end
puts "Waited for #{delay} at #{Time.now.to_s}" if delay > 10
end
run(lambda do |env|
[200, {'Content-Type'=>'text/plain'}, StringIO.new("ping\n")]
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment