From ca5542c7d5512543007d2b98d2eb7797c91da81d Mon Sep 17 00:00:00 2001 From: algolia-bot Date: Thu, 5 Dec 2024 13:10:24 +0000 Subject: [PATCH] feat(generators): allow per-spec timeouts [skip-bc] (generated) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/algolia/api-clients-automation/pull/4173 Co-authored-by: algolia-bot Co-authored-by: Clément Vannicatte Co-authored-by: Pierre Millot Co-authored-by: Thomas Raffray --- lib/algolia/api/abtesting_client.rb | 12 ++++++++++++ lib/algolia/api/analytics_client.rb | 12 ++++++++++++ lib/algolia/api/ingestion_client.rb | 12 ++++++++++++ lib/algolia/api/insights_client.rb | 12 ++++++++++++ lib/algolia/api/personalization_client.rb | 12 ++++++++++++ lib/algolia/api/query_suggestions_client.rb | 12 ++++++++++++ lib/algolia/configuration.rb | 4 ++-- 7 files changed, 74 insertions(+), 2 deletions(-) diff --git a/lib/algolia/api/abtesting_client.rb b/lib/algolia/api/abtesting_client.rb index 61325f31..bbb1b6fc 100644 --- a/lib/algolia/api/abtesting_client.rb +++ b/lib/algolia/api/abtesting_client.rb @@ -21,6 +21,18 @@ def self.create(app_id, api_key, region = nil, opts = {}) region = nil end + if opts.nil? || opts[:connect_timeout].nil? + opts[:connect_timeout] = 2000 + end + + if opts.nil? || opts[:read_timeout].nil? + opts[:read_timeout] = 5000 + end + + if opts.nil? || opts[:write_timeout].nil? + opts[:write_timeout] = 30000 + end + if !region.nil? && (!region.is_a?(String) || !regions.include?(region)) raise "`region` must be one of the following: #{regions.join(", ")}" end diff --git a/lib/algolia/api/analytics_client.rb b/lib/algolia/api/analytics_client.rb index b2e9881b..c92bc0ee 100644 --- a/lib/algolia/api/analytics_client.rb +++ b/lib/algolia/api/analytics_client.rb @@ -21,6 +21,18 @@ def self.create(app_id, api_key, region = nil, opts = {}) region = nil end + if opts.nil? || opts[:connect_timeout].nil? + opts[:connect_timeout] = 2000 + end + + if opts.nil? || opts[:read_timeout].nil? + opts[:read_timeout] = 5000 + end + + if opts.nil? || opts[:write_timeout].nil? + opts[:write_timeout] = 30000 + end + if !region.nil? && (!region.is_a?(String) || !regions.include?(region)) raise "`region` must be one of the following: #{regions.join(", ")}" end diff --git a/lib/algolia/api/ingestion_client.rb b/lib/algolia/api/ingestion_client.rb index d80e7c0c..06debab5 100644 --- a/lib/algolia/api/ingestion_client.rb +++ b/lib/algolia/api/ingestion_client.rb @@ -21,6 +21,18 @@ def self.create(app_id, api_key, region = nil, opts = {}) region = nil end + if opts.nil? || opts[:connect_timeout].nil? + opts[:connect_timeout] = 25000 + end + + if opts.nil? || opts[:read_timeout].nil? + opts[:read_timeout] = 25000 + end + + if opts.nil? || opts[:write_timeout].nil? + opts[:write_timeout] = 25000 + end + if region.nil? || !region.is_a?(String) || !regions.include?(region) raise "`region` is required and must be one of the following: #{regions.join(", ")}" end diff --git a/lib/algolia/api/insights_client.rb b/lib/algolia/api/insights_client.rb index 07cdbbc3..e0b0d99d 100644 --- a/lib/algolia/api/insights_client.rb +++ b/lib/algolia/api/insights_client.rb @@ -21,6 +21,18 @@ def self.create(app_id, api_key, region = nil, opts = {}) region = nil end + if opts.nil? || opts[:connect_timeout].nil? + opts[:connect_timeout] = 2000 + end + + if opts.nil? || opts[:read_timeout].nil? + opts[:read_timeout] = 5000 + end + + if opts.nil? || opts[:write_timeout].nil? + opts[:write_timeout] = 30000 + end + if !region.nil? && (!region.is_a?(String) || !regions.include?(region)) raise "`region` must be one of the following: #{regions.join(", ")}" end diff --git a/lib/algolia/api/personalization_client.rb b/lib/algolia/api/personalization_client.rb index 862763aa..9e0bb489 100644 --- a/lib/algolia/api/personalization_client.rb +++ b/lib/algolia/api/personalization_client.rb @@ -21,6 +21,18 @@ def self.create(app_id, api_key, region = nil, opts = {}) region = nil end + if opts.nil? || opts[:connect_timeout].nil? + opts[:connect_timeout] = 2000 + end + + if opts.nil? || opts[:read_timeout].nil? + opts[:read_timeout] = 5000 + end + + if opts.nil? || opts[:write_timeout].nil? + opts[:write_timeout] = 30000 + end + if region.nil? || !region.is_a?(String) || !regions.include?(region) raise "`region` is required and must be one of the following: #{regions.join(", ")}" end diff --git a/lib/algolia/api/query_suggestions_client.rb b/lib/algolia/api/query_suggestions_client.rb index ee8da8a1..6463489d 100644 --- a/lib/algolia/api/query_suggestions_client.rb +++ b/lib/algolia/api/query_suggestions_client.rb @@ -21,6 +21,18 @@ def self.create(app_id, api_key, region = nil, opts = {}) region = nil end + if opts.nil? || opts[:connect_timeout].nil? + opts[:connect_timeout] = 2000 + end + + if opts.nil? || opts[:read_timeout].nil? + opts[:read_timeout] = 5000 + end + + if opts.nil? || opts[:write_timeout].nil? + opts[:write_timeout] = 30000 + end + if region.nil? || !region.is_a?(String) || !regions.include?(region) raise "`region` is required and must be one of the following: #{regions.join(", ")}" end diff --git a/lib/algolia/configuration.rb b/lib/algolia/configuration.rb index b975a647..2d69b8ea 100644 --- a/lib/algolia/configuration.rb +++ b/lib/algolia/configuration.rb @@ -25,9 +25,9 @@ def initialize(app_id, api_key, hosts, client_name, opts = {}) @app_id = app_id @api_key = api_key @client_side_validation = opts[:client_side_validation].nil? ? true : opts[:client_side_validation] - @write_timeout = opts[:write_timeout] || 30_000 - @read_timeout = opts[:read_timeout] || 5_000 @connect_timeout = opts[:connect_timeout] || 2_000 + @read_timeout = opts[:read_timeout] || 5_000 + @write_timeout = opts[:write_timeout] || 30_000 @compression_type = opts[:compression_type] || "none" @requester = opts[:requester]