celluloid-benchmark 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/celluloid_benchmark/version.rb +1 -1
- data/lib/celluloid_benchmark/visitor.rb +13 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b435758072da96942609c7490da315570e7a337
|
4
|
+
data.tar.gz: 5f9bda856c10272c4aa90284c6f19bff37bb9368
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81cb52aeffd41b3c0adddda8023887d06a6b4683d5a958234385dc16457469cfa8fbb24c64a7ba930202ad792912e6956363254a158806c61c3361b3927c99d5
|
7
|
+
data.tar.gz: d7682869220d791ddd3bc8335cf908a8be5544f794a4565fca62e05cced77548b4ff0c4d74731188be1acfbbb5c644997c68650f6d4de091501e8f612ba593f4
|
@@ -2,15 +2,15 @@ require "mechanize"
|
|
2
2
|
require_relative "data_sources"
|
3
3
|
|
4
4
|
module CelluloidBenchmark
|
5
|
-
# Actor that models a person using a web browser. Runs a test scenario. Delegates web browsing to
|
5
|
+
# Actor that models a person using a web browser. Runs a test scenario. Delegates web browsing to
|
6
6
|
# instance of a Mechanize Agent.
|
7
7
|
class Visitor
|
8
8
|
include Celluloid
|
9
9
|
include CelluloidBenchmark::DataSources
|
10
|
-
|
10
|
+
|
11
11
|
extend Forwardable
|
12
12
|
|
13
|
-
def_delegators :@browser, :add_auth, :get, :submit, :transact
|
13
|
+
def_delegators :@browser, :add_auth, :get, :post, :put, :submit, :transact
|
14
14
|
|
15
15
|
attr_reader :benchmark_run
|
16
16
|
attr_reader :browser
|
@@ -35,20 +35,20 @@ module CelluloidBenchmark
|
|
35
35
|
rescue Mechanize::ResponseCodeError => e
|
36
36
|
log_response_code_error e
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
elapsed_time = Time.now - started_at
|
40
40
|
end
|
41
41
|
elapsed_time
|
42
42
|
end
|
43
|
-
|
43
|
+
|
44
44
|
def benchmark(label, threshold = 0.5)
|
45
45
|
self.current_request_label = label
|
46
46
|
self.current_request_threshold = threshold
|
47
47
|
end
|
48
|
-
|
49
|
-
|
48
|
+
|
49
|
+
|
50
50
|
private
|
51
|
-
|
51
|
+
|
52
52
|
def add_browser_timing_hooks
|
53
53
|
browser.pre_connect_hooks << proc do |agent, request|
|
54
54
|
self.request_start_time = Time.now
|
@@ -59,14 +59,14 @@ module CelluloidBenchmark
|
|
59
59
|
benchmark_run.async.log response.code, request_start_time, request_end_time, current_request_label, current_request_threshold
|
60
60
|
end
|
61
61
|
end
|
62
|
-
|
62
|
+
|
63
63
|
def log_response_code_error(error)
|
64
64
|
self.request_end_time = Time.now
|
65
65
|
benchmark_run.async.log(
|
66
|
-
error.response_code,
|
67
|
-
request_start_time,
|
68
|
-
request_end_time,
|
69
|
-
current_request_label,
|
66
|
+
error.response_code,
|
67
|
+
request_start_time,
|
68
|
+
request_end_time,
|
69
|
+
current_request_label,
|
70
70
|
current_request_threshold
|
71
71
|
)
|
72
72
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: celluloid-benchmark
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Willson
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-04-07 00:00:00 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: celluloid
|