module Cutoff::Patch::NetHttp

Set checkpoints for Ruby HTTP requests. Also sets the Net::HTTP timeouts to the remaining cutoff time. You can select this patch with `exclude` or `only` using the checkpoint name `:net_http`.

Public Class Methods

gen_timeout_method(name) click to toggle source
# File lib/cutoff/patch/net_http.rb, line 11
      def self.gen_timeout_method(name)
        <<~RUBY
          if #{name}.nil? || #{name} > remaining
            self.#{name} = cutoff.seconds_remaining
          end
        RUBY
      end
use_write_timeout?() click to toggle source
# File lib/cutoff/patch/net_http.rb, line 19
def self.use_write_timeout?
  Gem::Version.new(RUBY_VERSION) > Gem::Version.new('2.6')
end