prebake 0.3.7 → 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8773dbffbc19494a8ca48af28bf2d68bef4f4ebecae1fd37ff7ec171880b2c4d
4
- data.tar.gz: a3e243baec1fcebd091c3b7b466f65cb6f74b0cfc6ca5a9f69f81e46cbd2eea8
3
+ metadata.gz: 19a1c62dd2df6b16ab27629bda27ea6d6c18ae200c6e5874e1de7a17a642b643
4
+ data.tar.gz: ddcba7e497fa98ce7955fb0c78804a64945f5a8d64b6fa017d56b23a32f624fe
5
5
  SHA512:
6
- metadata.gz: efbb626624281ca0488cd549ffa3e8467c7601214153733d7e035c949c9b0c7c275b3668ea616c386b7d2726090e8309613ab7727295940c02fd6f23c1119ac9
7
- data.tar.gz: 0a0ce57c3e7bbd2f03c8d0c1f9d7883d2d8b46389a0dbaccfed45ae545be05b88fb2e7f40d45fc386ede90b778e3684564b5fafdf02f8765d7a3eb68311e6eec
6
+ metadata.gz: d5e9a824142b4bb5734a917ed9b52fc2ec75286fee31bd41129f0b7aeadffd4e918ff368a64a64e0262b365823e448d505f7a9e5af1d69380ba78c2cc816c74a
7
+ data.tar.gz: 33687eb0a1d9ddf94b2b1773b2a9548783c93280c8731a1cc6c56bc598543ec339fdaebf336986b1f4727ef759795ea2dae048907b73fc5d715b4921c800fb2c
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "net/http"
4
+ require "timeout"
4
5
 
5
6
  module Prebake
6
7
  module Backends
7
8
  module HttpClient
8
9
  TIMEOUT = 30
10
+ # Net::HTTP's timeouts restart on every read, so a trickling response needs a total cap.
11
+ DEADLINE = 10
9
12
  HTTP_METHODS = { get: Net::HTTP::Get, head: Net::HTTP::Head,
10
13
  post: Net::HTTP::Post, put: Net::HTTP::Put,
11
14
  delete: Net::HTTP::Delete }.freeze
@@ -13,18 +16,27 @@ module Prebake
13
16
  private
14
17
 
15
18
  def http_request(method, uri, body: nil)
19
+ # After one failed download the cache is likely struggling, so the rest of the install builds from source.
20
+ raise Error, "Skipped: an earlier request to the cache failed" if @unavailable && !body
21
+
16
22
  request = build_http_request(method, uri)
17
23
  if body
18
24
  request["Content-Type"] = "application/octet-stream"
19
25
  request.body = body
20
26
  end
21
27
 
22
- Net::HTTP.start(uri.host, uri.port,
23
- use_ssl: uri.scheme == "https",
24
- open_timeout: TIMEOUT,
25
- read_timeout: TIMEOUT) do |http|
26
- http.request(request)
28
+ # Uploads carry whole gems, so they keep only the per-phase timeouts.
29
+ Timeout.timeout(body ? nil : DEADLINE) do
30
+ Net::HTTP.start(uri.host, uri.port,
31
+ use_ssl: uri.scheme == "https",
32
+ open_timeout: TIMEOUT,
33
+ read_timeout: TIMEOUT) do |http|
34
+ http.request(request)
35
+ end
27
36
  end
37
+ rescue StandardError
38
+ @unavailable = true unless body
39
+ raise
28
40
  end
29
41
 
30
42
  def build_http_request(method, uri)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prebake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thejus Paul
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-10-26 00:00:00.000000000 Z
11
+ date: 2026-10-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Prebake speeds up bundle install by skipping native gem compilation.
14
14
  It fetches precompiled binaries for gems like puma, nokogiri, pg, grpc, and bootsnap