Skip to content

Commit

Permalink
changed timeout accessor to request_timeout to fix conflicts with Rub…
Browse files Browse the repository at this point in the history
…y's timeout std lib on JRuby
  • Loading branch information
rmanalan committed Aug 29, 2009
1 parent 94b6201 commit 02d583d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/geokit/geocoders.rb
Expand Up @@ -67,7 +67,7 @@ module Geocoders
@@proxy_port = nil
@@proxy_user = nil
@@proxy_pass = nil
@@timeout = nil
@@request_timeout = nil
@@yahoo = 'REPLACE_WITH_YOUR_YAHOO_KEY'
@@google = 'REPLACE_WITH_YOUR_GOOGLE_KEY'
@@geocoder_us = false
Expand Down Expand Up @@ -133,7 +133,7 @@ def self.reverse_geocode(latlng)

# Call the geocoder service using the timeout if configured.
def self.call_geocoder_service(url)
timeout(Geokit::Geocoders::timeout) { return self.do_get(url) } if Geokit::Geocoders::timeout
Timeout::timeout(Geokit::Geocoders::request_timeout) { return self.do_get(url) } if Geokit::Geocoders::request_timeout
return self.do_get(url)
rescue TimeoutError
return nil
Expand Down
2 changes: 1 addition & 1 deletion test/test_base_geocoder.rb
Expand Up @@ -36,7 +36,7 @@ def setup

def test_timeout_call_web_service
url = "http://www.anything.com"
Geokit::Geocoders::timeout = 1
Geokit::Geocoders::request_timeout = 1
assert_nil Geokit::Geocoders::TestGeocoder.call_geocoder_service(url)
end

Expand Down

0 comments on commit 02d583d

Please sign in to comment.