Skip to content

Commit ca5542c

Browse files
algolia-botshortcutsmillotpFluf22
committed
feat(generators): allow per-spec timeouts [skip-bc] (generated)
algolia/api-clients-automation#4173 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]> Co-authored-by: Pierre Millot <[email protected]> Co-authored-by: Thomas Raffray <[email protected]>
1 parent f604a7b commit ca5542c

7 files changed

+74
-2
lines changed

lib/algolia/api/abtesting_client.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ def self.create(app_id, api_key, region = nil, opts = {})
2121
region = nil
2222
end
2323

24+
if opts.nil? || opts[:connect_timeout].nil?
25+
opts[:connect_timeout] = 2000
26+
end
27+
28+
if opts.nil? || opts[:read_timeout].nil?
29+
opts[:read_timeout] = 5000
30+
end
31+
32+
if opts.nil? || opts[:write_timeout].nil?
33+
opts[:write_timeout] = 30000
34+
end
35+
2436
if !region.nil? && (!region.is_a?(String) || !regions.include?(region))
2537
raise "`region` must be one of the following: #{regions.join(", ")}"
2638
end

lib/algolia/api/analytics_client.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ def self.create(app_id, api_key, region = nil, opts = {})
2121
region = nil
2222
end
2323

24+
if opts.nil? || opts[:connect_timeout].nil?
25+
opts[:connect_timeout] = 2000
26+
end
27+
28+
if opts.nil? || opts[:read_timeout].nil?
29+
opts[:read_timeout] = 5000
30+
end
31+
32+
if opts.nil? || opts[:write_timeout].nil?
33+
opts[:write_timeout] = 30000
34+
end
35+
2436
if !region.nil? && (!region.is_a?(String) || !regions.include?(region))
2537
raise "`region` must be one of the following: #{regions.join(", ")}"
2638
end

lib/algolia/api/ingestion_client.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ def self.create(app_id, api_key, region = nil, opts = {})
2121
region = nil
2222
end
2323

24+
if opts.nil? || opts[:connect_timeout].nil?
25+
opts[:connect_timeout] = 25000
26+
end
27+
28+
if opts.nil? || opts[:read_timeout].nil?
29+
opts[:read_timeout] = 25000
30+
end
31+
32+
if opts.nil? || opts[:write_timeout].nil?
33+
opts[:write_timeout] = 25000
34+
end
35+
2436
if region.nil? || !region.is_a?(String) || !regions.include?(region)
2537
raise "`region` is required and must be one of the following: #{regions.join(", ")}"
2638
end

lib/algolia/api/insights_client.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ def self.create(app_id, api_key, region = nil, opts = {})
2121
region = nil
2222
end
2323

24+
if opts.nil? || opts[:connect_timeout].nil?
25+
opts[:connect_timeout] = 2000
26+
end
27+
28+
if opts.nil? || opts[:read_timeout].nil?
29+
opts[:read_timeout] = 5000
30+
end
31+
32+
if opts.nil? || opts[:write_timeout].nil?
33+
opts[:write_timeout] = 30000
34+
end
35+
2436
if !region.nil? && (!region.is_a?(String) || !regions.include?(region))
2537
raise "`region` must be one of the following: #{regions.join(", ")}"
2638
end

lib/algolia/api/personalization_client.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ def self.create(app_id, api_key, region = nil, opts = {})
2121
region = nil
2222
end
2323

24+
if opts.nil? || opts[:connect_timeout].nil?
25+
opts[:connect_timeout] = 2000
26+
end
27+
28+
if opts.nil? || opts[:read_timeout].nil?
29+
opts[:read_timeout] = 5000
30+
end
31+
32+
if opts.nil? || opts[:write_timeout].nil?
33+
opts[:write_timeout] = 30000
34+
end
35+
2436
if region.nil? || !region.is_a?(String) || !regions.include?(region)
2537
raise "`region` is required and must be one of the following: #{regions.join(", ")}"
2638
end

lib/algolia/api/query_suggestions_client.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ def self.create(app_id, api_key, region = nil, opts = {})
2121
region = nil
2222
end
2323

24+
if opts.nil? || opts[:connect_timeout].nil?
25+
opts[:connect_timeout] = 2000
26+
end
27+
28+
if opts.nil? || opts[:read_timeout].nil?
29+
opts[:read_timeout] = 5000
30+
end
31+
32+
if opts.nil? || opts[:write_timeout].nil?
33+
opts[:write_timeout] = 30000
34+
end
35+
2436
if region.nil? || !region.is_a?(String) || !regions.include?(region)
2537
raise "`region` is required and must be one of the following: #{regions.join(", ")}"
2638
end

lib/algolia/configuration.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ def initialize(app_id, api_key, hosts, client_name, opts = {})
2525
@app_id = app_id
2626
@api_key = api_key
2727
@client_side_validation = opts[:client_side_validation].nil? ? true : opts[:client_side_validation]
28-
@write_timeout = opts[:write_timeout] || 30_000
29-
@read_timeout = opts[:read_timeout] || 5_000
3028
@connect_timeout = opts[:connect_timeout] || 2_000
29+
@read_timeout = opts[:read_timeout] || 5_000
30+
@write_timeout = opts[:write_timeout] || 30_000
3131
@compression_type = opts[:compression_type] || "none"
3232
@requester = opts[:requester]
3333

0 commit comments

Comments
 (0)