Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ jobs:
fail-fast: false
matrix:
# https://endoflife.date/ruby
ruby: ["2.7", "3.0", "3.1", "3.2"]
vault: ["1.11.9", "1.12.5", "1.13.1"]
ruby: ["3.1", "3.2", "3.3", "3.4"]
vault: ["1.14.10", "1.15.6", "1.16.3", "1.17.6", "1.18.4"]
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: ruby/setup-ruby@22fdc77bf4148f810455b226c90fb81b5cbc00a7 # v1.171.0
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: ruby/setup-ruby@32110d4e311bd8996b2a82bf2a43b714ccc91777 # v1.221.0
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
Expand Down
16 changes: 13 additions & 3 deletions lib/vault/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
require "json"
require "uri"

require_relative "persistent"
require "net/http/persistent"

require_relative "configurable"
require_relative "errors"
require_relative "version"
Expand Down Expand Up @@ -50,6 +51,14 @@ class Client
a << Errno::ECONNREFUSED
a << Errno::EADDRNOTAVAIL

# Broken connection errors
a << Errno::ECONNRESET
a << Errno::ECONNABORTED
a << Errno::EPIPE
a << Errno::ETIMEDOUT
a << OpenSSL::SSL::SSLError
a << IOError

# Failed to read body or no response body given
a << EOFError

Expand All @@ -61,7 +70,7 @@ class Client
a << Net::ReadTimeout if defined?(Net::ReadTimeout)
a << Net::OpenTimeout if defined?(Net::OpenTimeout)

a << PersistentHTTP::Error
a << Net::HTTP::Persistent::Error
end.freeze

# Vault requires at least TLS1.2
Expand Down Expand Up @@ -92,7 +101,8 @@ def pool
@lock.synchronize do
return @nhp if @nhp

@nhp = PersistentHTTP.new("vault-ruby", nil, pool_size, pool_timeout)
@nhp = Net::HTTP::Persistent.new(name: "vault-ruby", pool_size:)
@nhp.pool.instance_variable_set(:@timeout, pool_timeout)

if proxy_address
proxy_uri = URI.parse "http://#{proxy_address}"
Expand Down
Loading