module Cutoff::Patch::NetHttp
Adds a checkpoint for starting HTTP requests and sets network timeouts to the remaining time
Public Class Methods
new(address, port = nil)
click to toggle source
Construct a {Net::HTTP}, but with the timeouts set to the remaining cutoff time if one is active
Calls superclass method
# File lib/cutoff/patch/net_http.rb, line 12 def initialize(address, port = nil) super return unless (cutoff = Cutoff.current) @open_timeout = cutoff.seconds_remaining @read_timeout = cutoff.seconds_remaining @write_timeout = cutoff.seconds_remaining end
Public Instance Methods
start()
click to toggle source
Same as the original start, but with a cutoff checkpoint
@see {Net::HTTP#start}
Calls superclass method
# File lib/cutoff/patch/net_http.rb, line 24 def start Cutoff.checkpoint! super end