Merge pull request #3808 from betagouv/add_timeout_to_address_api
ApiAdresse: add timeout
This commit is contained in:
commit
d0d8eb34c5
1 changed files with 4 additions and 1 deletions
|
@ -2,7 +2,10 @@ class ApiAdresse::API
|
|||
def self.call(address, limit = 1)
|
||||
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
|
||||
nil
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue