Skip to content

Commit 9dbd07a

Browse files
committed
(PE-41918) Configure net-http read_timeout on Windows
This passes the `read-timeout` config to the net-http client when running on Windows. Previously, this option was not being set, causing the client to drop the connection once the default timeout of 60s was reached.
1 parent b78d077 commit 9dbd07a

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)