Skip to content

Commit

Permalink
feat(generators): allow per-spec timeouts [skip-bc] (generated)
Browse files Browse the repository at this point in the history
algolia/api-clients-automation#4173

Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com>
Co-authored-by: Clément Vannicatte <vannicattec@gmail.com>
Co-authored-by: Pierre Millot <pierre.millot@algolia.com>
Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com>
  • Loading branch information
4 people committed Dec 5, 2024
1 parent f604a7b commit ca5542c
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 2 deletions.
12 changes: 12 additions & 0 deletions lib/algolia/api/abtesting_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions lib/algolia/api/analytics_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions lib/algolia/api/ingestion_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions lib/algolia/api/insights_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions lib/algolia/api/personalization_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions lib/algolia/api/query_suggestions_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/algolia/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down

0 comments on commit ca5542c

Please sign in to comment.