chore(combobox): add timeout on datasources

This commit is contained in:
Paul Chavard 2024-03-04 08:28:43 +01:00
parent 2d76e8386e
commit 223e6dfb2d
2 changed files with 4 additions and 4 deletions

View file

@ -18,7 +18,7 @@ class DataSources::AdresseController < ApplicationController
private
def fetch_results
Typhoeus.get("#{API_ADRESSE_URL}/search", params: { q: params[:q], limit: 10 })
Typhoeus.get("#{API_ADRESSE_URL}/search", params: { q: params[:q], limit: 10 }, timeout: 3)
end
def format_results(results)

View file

@ -31,7 +31,7 @@ class DataSources::CommuneController < ApplicationController
nom: name,
boost: 'population',
limit: 100
})
}, timeout: 3)
end
def fetch_by_postal_code(postal_code)
@ -39,8 +39,8 @@ class DataSources::CommuneController < ApplicationController
type: 'commune-actuelle,arrondissement-municipal',
codePostal: postal_code,
boost: 'population',
limit: 50,
})
limit: 50
}, timeout: 3)
end
def postal_code?(string)