Added timeout options for Faraday.
This commit is contained in:
parent
d6ebe079e6
commit
d7dd63ae4a
1 changed files with 1 additions and 1 deletions
|
@ -16,7 +16,7 @@ class GeoIp::Freegeoip
|
|||
url = "/json/#{CGI::escape address}"
|
||||
data = {}
|
||||
begin
|
||||
conn = Faraday.new( :url => host )
|
||||
conn = Faraday.new( :url => host, :options => { :open_timeout => 2, :timeout => 5 } )
|
||||
response = conn.get url
|
||||
data = JSON.parse( response.body )
|
||||
Cache.write( cache_key, data, { :expires_in => 90.days } )
|
||||
|
|
Loading…
Reference in a new issue