Skip to content

Instantly share code, notes, and snippets.

@kirs
Created April 17, 2017 02:47
Show Gist options
  • Save kirs/161d211730c2b3e38bde90b1e4065056 to your computer and use it in GitHub Desktop.
Save kirs/161d211730c2b3e38bde90b1e4065056 to your computer and use it in GitHub Desktop.
require "net/http"
require "uri"
trap("TERM") do
puts 'terminating...'
end
loop do
begin
http = Net::HTTP.new("www.google.com", 81)
http.open_timeout = 5
http.read_timeout = 5
request = Net::HTTP::Get.new uri
http.request request
rescue => e
puts e.inspect
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment