Skip to content

Commit 09e6ac6

Browse files
author
Christopher Frost
committed
Remove the Download cache timeout
This commit removes the timeout limit for the download cache, instead falling back to the Ruby default of 60 seconds. [#83473194]
1 parent 0b9a0cf commit 09e6ac6

2 files changed

Lines changed: 5 additions & 16 deletions

File tree

lib/java_buildpack/util/cache/download_cache.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,7 @@ def evict(uri)
110110
Net::HTTPTemporaryRedirect
111111
].freeze
112112

113-
TIMEOUT_SECONDS = 10.freeze
114-
115-
private_constant :CA_FILE, :FAILURE_LIMIT, :HTTP_ERRORS, :REDIRECT_TYPES, :TIMEOUT_SECONDS
113+
private_constant :CA_FILE, :FAILURE_LIMIT, :HTTP_ERRORS, :REDIRECT_TYPES
116114

117115
def attempt(http, request, cached_file)
118116
downloaded = false
@@ -213,9 +211,6 @@ def from_immutable_caches(uri)
213211
# Beware known problems with timeouts: https://www.ruby-forum.com/topic/143840
214212
def http_options(rich_uri)
215213
http_options = {}
216-
http_options[:connect_timeout] = TIMEOUT_SECONDS
217-
http_options[:open_timeout] = TIMEOUT_SECONDS
218-
http_options[:read_timeout] = TIMEOUT_SECONDS
219214

220215
if secure?(rich_uri)
221216
http_options[:use_ssl] = true

spec/java_buildpack/util/cache/download_cache_spec.rb

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,7 @@
239239
.to_return(status: 200, body: 'foo-cached', headers: { Etag: 'foo-etag', 'Last-Modified' => 'foo-last-modified' })
240240

241241
allow(Net::HTTP).to receive(:Proxy).and_call_original
242-
expect(Net::HTTP).to receive(:start).with('foo-uri', 80, connect_timeout: 10, open_timeout: 10, read_timeout: 10)
243-
.and_call_original
242+
expect(Net::HTTP).to receive(:start).with('foo-uri', 80, {}).and_call_original
244243

245244
download_cache.get(uri) {}
246245
end
@@ -251,8 +250,7 @@
251250

252251
allow(ca_certs_directory).to receive(:exist?).and_return(true)
253252
allow(Net::HTTP).to receive(:Proxy).and_call_original
254-
expect(Net::HTTP).to receive(:start).with('foo-uri', 80, connect_timeout: 10, open_timeout: 10, read_timeout: 10)
255-
.and_call_original
253+
expect(Net::HTTP).to receive(:start).with('foo-uri', 80, {}).and_call_original
256254

257255
download_cache.get(uri) {}
258256
end
@@ -262,9 +260,7 @@
262260
.to_return(status: 200, body: 'foo-cached', headers: { Etag: 'foo-etag', 'Last-Modified' => 'foo-last-modified' })
263261

264262
allow(Net::HTTP).to receive(:Proxy).and_call_original
265-
expect(Net::HTTP).to receive(:start)
266-
.with('foo-uri', 443, connect_timeout: 10, open_timeout: 10, read_timeout: 10, use_ssl: true)
267-
.and_call_original
263+
expect(Net::HTTP).to receive(:start).with('foo-uri', 443, use_ssl: true).and_call_original
268264

269265
download_cache.get(uri_secure) {}
270266
end
@@ -275,9 +271,7 @@
275271

276272
allow(ca_certs_directory).to receive(:exist?).and_return(true)
277273
allow(Net::HTTP).to receive(:Proxy).and_call_original
278-
expect(Net::HTTP).to receive(:start)
279-
.with('foo-uri', 443, connect_timeout: 10, open_timeout: 10, read_timeout: 10, use_ssl: true,
280-
ca_file: 'test-path').and_call_original
274+
expect(Net::HTTP).to receive(:start).with('foo-uri', 443, use_ssl: true, ca_file: 'test-path').and_call_original
281275

282276
download_cache.get(uri_secure) {}
283277
end

0 commit comments

Comments
 (0)