From 223e6dfb2d8253bce246cc042a12db569bb0f04d Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Mon, 4 Mar 2024 08:28:43 +0100 Subject: [PATCH] chore(combobox): add timeout on datasources --- app/controllers/data_sources/adresse_controller.rb | 2 +- app/controllers/data_sources/commune_controller.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/data_sources/adresse_controller.rb b/app/controllers/data_sources/adresse_controller.rb index dd1de00f3..63fa62ff9 100644 --- a/app/controllers/data_sources/adresse_controller.rb +++ b/app/controllers/data_sources/adresse_controller.rb @@ -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) diff --git a/app/controllers/data_sources/commune_controller.rb b/app/controllers/data_sources/commune_controller.rb index 42b1dd44b..825d3f7c4 100644 --- a/app/controllers/data_sources/commune_controller.rb +++ b/app/controllers/data_sources/commune_controller.rb @@ -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)