Skip to content

Commit c59e9eb

Browse files
Merge pull request #43 from puppetlabs/PE-41918/read-timeout
(PE-41918) Configure net-http read_timeout on Windows
2 parents b78d077 + 9dbd07a commit c59e9eb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/orchestrator_client.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@ def create_http(root_url)
2828
f.headers['User-Agent'] = config['User-Agent']
2929
f.ssl['ca_file'] = config['cacert']
3030
f.ssl['version'] = :TLSv1_2
31-
# Do not use net-http-persistent on windows
31+
# net-http-persistent does not work reliably on Windows, so fall back
32+
# to net-http
3233
if !!File::ALT_SEPARATOR
33-
f.adapter :net_http
34+
f.adapter :net_http do |http|
35+
http.read_timeout = config['read-timeout'] if config['read-timeout']
36+
end
3437
else
3538
f.adapter :net_http_persistent, pool_size: 5 do |http|
3639
http.idle_timeout = 30

0 commit comments

Comments
 (0)