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 +4 -4
- data/lib/benchmark/http/command/spider.rb +2 -1
- data/lib/benchmark/http/command.rb +4 -3
- data/lib/benchmark/http/spider.rb +8 -7
- data/lib/benchmark/http/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e94467fbbb53392ece96740e56933598ed0a301f8f6a897976e0d6ed59c2b5a0
|
4
|
+
data.tar.gz: e6ca7937b05e889a91cfca556b715c92724515caaa4bdbecfd523951a16d8739
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
63
|
+
Console.logger.debug!
|
63
64
|
elsif quiet?
|
64
|
-
|
65
|
+
Console.logger.warn!
|
65
66
|
else
|
66
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
121
|
+
Console.logger.error(self) {"Timeout while fetching #{url}"}
|
121
122
|
rescue StandardError
|
122
|
-
|
123
|
+
Console.logger.error(self) {$!}
|
123
124
|
end
|
124
125
|
|
125
126
|
sync def call(urls, &block)
|
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.
|
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-
|
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.
|
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.
|