Module: Cutoff::Patch::NetHttp

Defined in:
lib/cutoff/patch/net_http.rb

Overview

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.

Instance Method Summary collapse

Instance Method Details

#startObject

Same as the original start, but adds a checkpoint for starting HTTP requests and sets network timeouts to the remaining time

See Also:

  • Net::HTTP#start


32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/cutoff/patch/net_http.rb', line 32

module_eval("def start\n  if (cutoff = Cutoff.current) && cutoff.selected?(:net_http)\n    remaining = cutoff.seconds_remaining\n    \#{gen_timeout_method('open_timeout')}\n    \#{gen_timeout_method('read_timeout')}\n    \#{gen_timeout_method('write_timeout') if use_write_timeout?}\n    \#{gen_timeout_method('continue_timeout')}\n    Cutoff.checkpoint!(:net_http)\n  end\n  super\nend\n", __FILE__, __LINE__ + 1)