Created
February 25, 2021 08:20
-
-
Save kinnalru/6dada253de9d2e76a1f105c56b8465d9 to your computer and use it in GitHub Desktop.
make_requests_single
This file contains 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
def make_requests_single(uri, duration) | |
count = 0 | |
t = Process.clock_gettime(Process::CLOCK_MONOTONIC) | |
Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http| | |
http.max_retries = 0 | |
while (Process.clock_gettime(Process::CLOCK_MONOTONIC) - t) < duration do | |
data = "/#{count}" | |
http.get(uri + data).body | |
count += 1 | |
end | |
end | |
count | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment