freddy 0.5.8 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/freddy.gemspec +1 -1
- data/lib/freddy/producers/send_and_wait_response_producer.rb +1 -10
- metadata +3 -6
- data/lib/freddy/utils.rb +0 -30
- data/spec/freddy/utils_spec.rb +0 -83
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 616f7993a0da1423d5b0defb02cf3e4e75c51481
|
4
|
+
data.tar.gz: 44f8e9099607cc6073df4bb6fdb5cfef68692ede
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fe5040ae2e1611e6cc893f6f6783bcb6198c9dfc2fe2a2da497f2b240dc9d45f90aa4a3df89e1e4a0a09e5ee7e1815d51658f21dee31e8a633d3bfb3cb0eacd
|
7
|
+
data.tar.gz: 20f9a96c47647ceacc2d9a79de533ddcd57c6c81f3ad80d2052caef5ccd30d121fbd75557b75807c2c3cc0ffd6f5773dae3db257b5a9b45099b3cb64240e59d5
|
data/freddy.gemspec
CHANGED
@@ -67,10 +67,9 @@ class Freddy
|
|
67
67
|
if request = @request_manager.delete(correlation_id)
|
68
68
|
process_response(request, delivery)
|
69
69
|
else
|
70
|
-
|
70
|
+
message = "Got rpc response for correlation_id #{correlation_id} "\
|
71
71
|
"but there is no requester"
|
72
72
|
@logger.warn message
|
73
|
-
Utils.notify 'NoRequesterForResponse', warning, correlation_id: correlation_id
|
74
73
|
end
|
75
74
|
end
|
76
75
|
|
@@ -85,14 +84,6 @@ class Freddy
|
|
85
84
|
@logger.warn "Request timed out waiting response from #{destination}"\
|
86
85
|
", correlation id #{correlation_id}"
|
87
86
|
|
88
|
-
Utils.notify 'RequestTimeout',
|
89
|
-
"Request timed out waiting for response from #{destination}",
|
90
|
-
{
|
91
|
-
correlation_id: correlation_id,
|
92
|
-
destination: destination,
|
93
|
-
timeout_in_seconds: timeout_in_seconds
|
94
|
-
}
|
95
|
-
|
96
87
|
@request_manager.delete(correlation_id)
|
97
88
|
end
|
98
89
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: freddy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Urmas Talimaa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -134,14 +134,12 @@ files:
|
|
134
134
|
- lib/freddy/responder_handler.rb
|
135
135
|
- lib/freddy/sync_response_container.rb
|
136
136
|
- lib/freddy/timeout_error.rb
|
137
|
-
- lib/freddy/utils.rb
|
138
137
|
- spec/freddy/consumers/respond_to_consumer_spec.rb
|
139
138
|
- spec/freddy/error_response_spec.rb
|
140
139
|
- spec/freddy/freddy_spec.rb
|
141
140
|
- spec/freddy/message_handler_spec.rb
|
142
141
|
- spec/freddy/responder_handler_spec.rb
|
143
142
|
- spec/freddy/sync_response_container_spec.rb
|
144
|
-
- spec/freddy/utils_spec.rb
|
145
143
|
- spec/integration/concurrency_spec.rb
|
146
144
|
- spec/integration/logging_spec.rb
|
147
145
|
- spec/integration/reply_spec.rb
|
@@ -166,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
164
|
version: '0'
|
167
165
|
requirements: []
|
168
166
|
rubyforge_project:
|
169
|
-
rubygems_version: 2.
|
167
|
+
rubygems_version: 2.5.1
|
170
168
|
signing_key:
|
171
169
|
specification_version: 4
|
172
170
|
summary: API for inter-application messaging supporting acknowledgements and request-response
|
@@ -177,7 +175,6 @@ test_files:
|
|
177
175
|
- spec/freddy/message_handler_spec.rb
|
178
176
|
- spec/freddy/responder_handler_spec.rb
|
179
177
|
- spec/freddy/sync_response_container_spec.rb
|
180
|
-
- spec/freddy/utils_spec.rb
|
181
178
|
- spec/integration/concurrency_spec.rb
|
182
179
|
- spec/integration/logging_spec.rb
|
183
180
|
- spec/integration/reply_spec.rb
|
data/lib/freddy/utils.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
class Freddy
|
2
|
-
class Utils
|
3
|
-
def self.format_exception(exception)
|
4
|
-
message = exception.message
|
5
|
-
backtrace = exception.backtrace.join("\n")
|
6
|
-
|
7
|
-
"#{message}\n#{backtrace}"
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.notify(name, message, parameters={})
|
11
|
-
return unless defined?(Airbrake)
|
12
|
-
|
13
|
-
Airbrake.notify_or_ignore(
|
14
|
-
error_class: name,
|
15
|
-
error_message: message,
|
16
|
-
cgi_data: ENV.to_hash,
|
17
|
-
parameters: parameters
|
18
|
-
)
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.notify_exception(exception, parameters={})
|
22
|
-
return unless defined?(Airbrake)
|
23
|
-
|
24
|
-
Airbrake.notify_or_ignore(exception,
|
25
|
-
cgi_data: ENV.to_hash,
|
26
|
-
parameters: parameters
|
27
|
-
)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
data/spec/freddy/utils_spec.rb
DELETED
@@ -1,83 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Freddy::Utils do
|
4
|
-
describe '.format_exception' do
|
5
|
-
subject { described_class.format_exception(exception) }
|
6
|
-
|
7
|
-
let(:exception) { double(backtrace: backtrace, message: message) }
|
8
|
-
let(:message) { 'format exception test' }
|
9
|
-
let(:backtrace) { ['line1', 'line2', 'line3'] }
|
10
|
-
|
11
|
-
it 'format the exception' do
|
12
|
-
should eq "format exception test\n" \
|
13
|
-
"line1\n" \
|
14
|
-
"line2\n" \
|
15
|
-
'line3'
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe '.notify' do
|
20
|
-
subject { described_class.notify(error_class, error_message, parameters) }
|
21
|
-
|
22
|
-
let(:env_attributes) { double }
|
23
|
-
let(:error_class) { double }
|
24
|
-
let(:error_message) { double }
|
25
|
-
let(:parameters) { double }
|
26
|
-
|
27
|
-
context 'when Airbrake is defined' do
|
28
|
-
let(:airbrake) { double }
|
29
|
-
|
30
|
-
before do
|
31
|
-
allow(ENV).to receive(:to_hash) { env_attributes }
|
32
|
-
stub_const('::Airbrake', airbrake)
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'notifies airbrake' do
|
36
|
-
expect(airbrake).to receive(:notify_or_ignore).with(
|
37
|
-
error_class: error_class,
|
38
|
-
error_message: error_message,
|
39
|
-
cgi_data: env_attributes,
|
40
|
-
parameters: parameters
|
41
|
-
)
|
42
|
-
|
43
|
-
subject
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
context 'when Airbrake is not defined' do
|
48
|
-
it 'does nothing' do
|
49
|
-
should eq(nil)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
describe '.notify_exception' do
|
55
|
-
subject { described_class.notify_exception(exception, {a: 'b'}) }
|
56
|
-
|
57
|
-
let(:exception) { double }
|
58
|
-
|
59
|
-
context 'when Airbrake is defined' do
|
60
|
-
let(:airbrake) { double }
|
61
|
-
|
62
|
-
before do
|
63
|
-
stub_const('::Airbrake', airbrake)
|
64
|
-
end
|
65
|
-
|
66
|
-
it 'notifies airbrake' do
|
67
|
-
expect(airbrake).to receive(:notify_or_ignore) do |ex, content|
|
68
|
-
expect(ex).to eq(exception)
|
69
|
-
expect(content[:cgi_data]).to be_instance_of(Hash)
|
70
|
-
expect(content[:parameters]).to eq(a: 'b')
|
71
|
-
end
|
72
|
-
|
73
|
-
subject
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
context 'when Airbrake is not defined' do
|
78
|
-
it 'does nothing' do
|
79
|
-
should eq(nil)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|