Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Net::HTTP#max_retries=
(::Integer max_retries) -> ::Integer
max_retries=(retries)
lib/net/http.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/net/http.rb, line 1399
def max_retries=(retries)
retries = retries.to_int
if retries < 0
raise ArgumentError, 'max_retries should be non-negative integer number'
end
@max_retries = retries
end
Sets the maximum number of times to retry an idempotent request in case of Net::ReadTimeout, IOError, EOFError, Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPIPE, OpenSSL::SSL::SSLError, Timeout::Error. The initial value is 1.
Argument retries must be a non-negative numeric value:
Example
http = Net::HTTP.new(hostname) http.max_retries = 2 # => 2 http.max_retries # => 2