Skip to content

Commit

Permalink
[rubygems/rubygems] Use vendored timeout from RubyGems
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez authored and hsbt committed Dec 13, 2023
1 parent a7c9163 commit f188a41
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/bundler/fetcher.rb
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require_relative "vendored_persistent"
require_relative "vendored_timeout"
require "cgi"
require "securerandom"
require "zlib"
Expand Down Expand Up @@ -287,7 +288,7 @@ def gemspec_cached_path(spec_file_name)
end

HTTP_ERRORS = [
Timeout::Error, EOFError, SocketError, Errno::ENETDOWN, Errno::ENETUNREACH,
Gem::Timeout::Error, EOFError, SocketError, Errno::ENETDOWN, Errno::ENETUNREACH,
Errno::EINVAL, Errno::ECONNRESET, Errno::ETIMEDOUT, Errno::EAGAIN,
Gem::Net::HTTPBadResponse, Gem::Net::HTTPHeaderSyntaxError, Gem::Net::ProtocolError,
Gem::Net::HTTP::Persistent::Error, Zlib::BufError, Errno::EHOSTUNREACH
Expand Down
4 changes: 2 additions & 2 deletions lib/bundler/vendor/connection_pool/lib/connection_pool.rb
@@ -1,12 +1,12 @@
require "timeout"
require_relative "../../../vendored_timeout"
require_relative "connection_pool/version"

class Bundler::ConnectionPool
class Error < ::RuntimeError; end

class PoolShuttingDownError < ::Bundler::ConnectionPool::Error; end

class TimeoutError < ::Timeout::Error; end
class TimeoutError < ::Gem::Timeout::Error; end
end

# Generic connection pool class for sharing a limited number of objects or network connections
Expand Down
8 changes: 8 additions & 0 deletions lib/bundler/vendored_timeout.rb
@@ -0,0 +1,8 @@
# frozen_string_literal: true

begin
require "rubygems/timeout"
rescue LoadError
require "timeout"
Gem::Timeout = Timeout
end

0 comments on commit f188a41

Please sign in to comment.