Created
October 15, 2011 21:19
-
-
Save heftig/1290166 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
# Need to block | |
begin | |
json = Timeout.timeout 3 do | |
Net::HTTP.new(uri.host, uri.port).start do |https| | |
https.request_get(uri.request_uri) | |
end | |
end | |
rescue Timeout::Error | |
if @retries >= 3 | |
return {return: 'Gateway Timeout.', response: 504} | |
end | |
@retries+=1 | |
sleep(1) | |
retry # Don't flood them. | |
end | |
# Need to block | |
# When I run the method it just keeps going and below this it tries to parse the JSON but errors out with NameError |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment