benchmark-http 0.15.0 → 0.15.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27ea6caaddb5d06fa3e0ed12357c6d39d5ac60cc47c0b30983709a5c8cff3db9
4
- data.tar.gz: bfca34e7f314b96dc953bebd6c0094ec9672d825e5623087947a0b3b2d03e66e
3
+ metadata.gz: e94467fbbb53392ece96740e56933598ed0a301f8f6a897976e0d6ed59c2b5a0
4
+ data.tar.gz: e6ca7937b05e889a91cfca556b715c92724515caaa4bdbecfd523951a16d8739
5
5
  SHA512:
6
- metadata.gz: c837530151c68de4a2b4b9927a5df019472b93e1d544860d8862c0d683845e7bdc7b5d040e06ee90641fd25fbcfee48b113f711b7c98a061ada66c499806e973
7
- data.tar.gz: 672d38bf11d11426d93d82ad96b94c63bb9eb108530185ecce219d89e47e7462b07db2f6686ae41680a362baba7804cf6b6ee648b50140140838b924920cc1b5
6
+ metadata.gz: 172464957224504d73e77fef8139beb33d19d9fe9098b42bf92393617a3f3dcdfee05f7aace4d8909ae05e6b03d9d60405a5e971055367372ab8e989c4aea135
7
+ data.tar.gz: ba6cb3332488f08e49d90e707d6333d34b56334e3bd575b4f7d9cb129b4dee75b9bc7a3a318a3be392f01a13594fd6537921bda27800aa53f58a38584da92d67
@@ -24,6 +24,7 @@ require 'async/await'
24
24
 
25
25
  require 'samovar'
26
26
  require 'uri'
27
+ require 'console'
27
28
 
28
29
  module Benchmark
29
30
  module HTTP
@@ -41,7 +42,7 @@ module Benchmark
41
42
  many :urls, "One or more hosts to benchmark"
42
43
 
43
44
  def log(method, url, response)
44
- Async.logger.call(self, severity: (response.failure? ? :warn : :info)) do |buffer|
45
+ Console.logger.call(self, severity: (response.failure? ? :warn : :info)) do |buffer|
45
46
  buffer.puts "#{method} #{url} -> #{response.version} #{response.status} (#{response.body&.length || 'unspecified'} bytes)"
46
47
 
47
48
  response.headers.each do |key, value|
@@ -25,6 +25,7 @@ require_relative 'command/hammer'
25
25
 
26
26
  require_relative 'version'
27
27
  require 'samovar'
28
+ require 'console'
28
29
 
29
30
  module Benchmark
30
31
  module HTTP
@@ -59,11 +60,11 @@ module Benchmark
59
60
 
60
61
  def call
61
62
  if verbose?
62
- Async.logger.debug!
63
+ Console.logger.debug!
63
64
  elsif quiet?
64
- Async.logger.warn!
65
+ Console.logger.warn!
65
66
  else
66
- Async.logger.info!
67
+ Console.logger.info!
67
68
  end
68
69
 
69
70
  if @options[:version]
@@ -28,6 +28,7 @@ require 'async/http/endpoint'
28
28
  require 'async/await'
29
29
 
30
30
  require 'uri'
31
+ require 'console'
31
32
 
32
33
  module Benchmark
33
34
  module HTTP
@@ -47,7 +48,7 @@ module Benchmark
47
48
  begin
48
49
  filter = LinksFilter.parse(body)
49
50
  rescue
50
- Async.logger.error(self) {$!}
51
+ Console.logger.error(self) {$!}
51
52
  return []
52
53
  end
53
54
 
@@ -65,7 +66,7 @@ module Benchmark
65
66
  yield full_url
66
67
  end
67
68
  rescue ArgumentError, URI::InvalidURIError
68
- Async.logger.warn(self) {"Could not fetch #{href}, relative to #{base}!"}
69
+ Console.logger.warn(self) {"Could not fetch #{href}, relative to #{base}!"}
69
70
  next # Don't accumulate an item into the resulting array.
70
71
  end
71
72
  end.compact
@@ -73,7 +74,7 @@ module Benchmark
73
74
 
74
75
  async def fetch(statistics, client, url, depth = @depth, fetched = Set.new, &block)
75
76
  if depth&.zero?
76
- Async.logger.warn(self) {"Exceeded depth while trying to visit #{url}!"}
77
+ Console.logger.warn(self) {"Exceeded depth while trying to visit #{url}!"}
77
78
  return
78
79
  elsif fetched.include?(url)
79
80
  return
@@ -92,11 +93,11 @@ module Benchmark
92
93
  if response.redirection?
93
94
  location = url + response.headers['location']
94
95
  if location.host == url.host
95
- Async.logger.debug(self) {"Following redirect to #{location}..."}
96
+ Console.logger.debug(self) {"Following redirect to #{location}..."}
96
97
  fetch(statistics, client, location, depth&.-(1), fetched, &block).wait
97
98
  return
98
99
  else
99
- Async.logger.debug(self) {"Ignoring redirect to #{location}."}
100
+ Console.logger.debug(self) {"Ignoring redirect to #{location}."}
100
101
  return
101
102
  end
102
103
  end
@@ -117,9 +118,9 @@ module Benchmark
117
118
  fetch(statistics, client, href, depth&.-(1), fetched, &block)
118
119
  end.each(&:wait)
119
120
  rescue Async::TimeoutError
120
- Async.logger.error(self) {"Timeout while fetching #{url}"}
121
+ Console.logger.error(self) {"Timeout while fetching #{url}"}
121
122
  rescue StandardError
122
- Async.logger.error(self) {$!}
123
+ Console.logger.error(self) {$!}
123
124
  end
124
125
 
125
126
  sync def call(urls, &block)
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Benchmark
22
22
  module HTTP
23
- VERSION = "0.15.0"
23
+ VERSION = "0.15.1"
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: benchmark-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-14 00:00:00.000000000 Z
11
+ date: 2021-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-await
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: console
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: samovar
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -188,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
202
  - !ruby/object:Gem::Version
189
203
  version: '0'
190
204
  requirements: []
191
- rubygems_version: 3.2.22
205
+ rubygems_version: 3.2.32
192
206
  signing_key:
193
207
  specification_version: 4
194
208
  summary: An asynchronous benchmark toolbox for modern HTTP servers.