Created
February 24, 2023 12:53
-
-
Save rob-murray/d3a1bc4c080e3be15c50469df0594329 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'benchmark' | |
def make_request(sleep_mins, read_timeout = 1) | |
puts "sleep_mins=#{sleep_mins} mins read_timeout=#{read_timeout} mins" | |
uri = URI.parse 'http://localhost:4040' | |
request = Net::HTTP::Get.new("/sleep?m=#{sleep_mins}") | |
Net::HTTP.start(uri.host, uri.port, read_timeout: (read_timeout * 60)) do |http| | |
http.request(request) | |
end | |
end | |
puts Benchmark.realtime { make_request(0.5) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment