ApiAdresse: add timeout
This commit is contained in:
parent
070ef13ea5
commit
14c3686969
1 changed files with 4 additions and 1 deletions
|
@ -2,7 +2,10 @@ class ApiAdresse::API
|
||||||
def self.call(address, limit = 1)
|
def self.call(address, limit = 1)
|
||||||
search_url = [API_ADRESSE_URL, "search"].join("/")
|
search_url = [API_ADRESSE_URL, "search"].join("/")
|
||||||
|
|
||||||
RestClient.get(search_url, params: { q: address, limit: limit })
|
RestClient::Request.execute(method: :get,
|
||||||
|
url: search_url,
|
||||||
|
timeout: 5,
|
||||||
|
headers: { params: { q: address, limit: limit } })
|
||||||
rescue RestClient::ServiceUnavailable
|
rescue RestClient::ServiceUnavailable
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue