Skip to content

Commit

Permalink
add write_timeout to posts
Browse files Browse the repository at this point in the history
  • Loading branch information
brianlball authored Sep 29, 2023
1 parent 69bc2fb commit 2972626
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/openstudio/analysis/server_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def initialize(options = {})
faraday.request :url_encoded # form-encode POST params
faraday.options.timeout = 300
faraday.options.open_timeout = 300
faraday.options.write_timeout = 1800
faraday.use Faraday::Response::Logger, @logger
# faraday.response @logger # log requests to STDOUT
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
Expand All @@ -44,6 +45,7 @@ def initialize(options = {})
faraday.request :url_encoded # form-encode POST params
faraday.options.timeout = 300
faraday.options.open_timeout = 300
faraday.options.write_timeout = 1800
faraday.use Faraday::Response::Logger, @logger
# faraday.response :logger # log requests to STDOUT
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
Expand Down Expand Up @@ -477,7 +479,8 @@ def new_analysis(project_id, options)
req.url "projects/#{project_id}/analyses.json"
req.headers['Content-Type'] = 'application/json'
req.body = formulation_json.to_json
req.options[:timeout] = 600 # seconds
req.options.timeout = 600 # seconds
req.options.write_timeout = 1800
end

if response.status == 201
Expand All @@ -497,7 +500,8 @@ def new_analysis(project_id, options)

payload = { file: Faraday::UploadIO.new(options[:upload_file], 'application/zip') }
response = @conn_multipart.post "analyses/#{analysis_id}/upload.json", payload do |req|
req.options[:timeout] = 1800 # seconds
req.options.timeout = 1800 # seconds
req.options.write_timeout = 1800
end

if response.status == 201
Expand Down Expand Up @@ -643,7 +647,8 @@ def start_analysis(analysis_id, options)
req.url "analyses/#{analysis_id}/action.json"
req.headers['Content-Type'] = 'application/json'
req.body = options.to_json
req.options[:timeout] = 1800 # seconds
req.options.timeout = 1800 # seconds
req.options.write_timeout = 1800
end

if response.status == 200
Expand Down

0 comments on commit 2972626

Please sign in to comment.