Created
October 22, 2010 16:35
-
-
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
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
#!/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 |
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
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