pwwka 0.22.3 → 0.22.4
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/pwwka/channel_connector.rb +8 -5
- data/lib/pwwka/version.rb +1 -1
- data/spec/unit/channel_connector_spec.rb +11 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4360e4e1bf6417591a5a20093a59b955c74b0dee9d620b6c517818535b26e4a4
|
4
|
+
data.tar.gz: 21599e4304fc3dd70ca7da613bf58d0eb91011b7cbf857713337cd4f65b37f16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8dbac3016d4ae303afc1d4a3c3e578c499075d2953d44c0d29b9f43746a3b6d72e96159cecd739c0dc3f7fe6d57500b24cc8b97ae35e99a9e5281572c3d4b9be
|
7
|
+
data.tar.gz: a6031931aa591d94868317baebe7d3540fffa16bad9397475ddeb501b741814a5fb2b935c4686b128a385c701ce66905df5a24140ed4e9c65eb4cb0a17bc1ba5
|
@@ -19,15 +19,19 @@ module Pwwka
|
|
19
19
|
@connection = Bunny.new(configuration.rabbit_mq_host, connection_options)
|
20
20
|
@connection.start
|
21
21
|
rescue => e
|
22
|
-
logf "ERROR Connecting to RabbitMQ",
|
22
|
+
logf "ERROR Connecting to RabbitMQ: #{e}", at: :error
|
23
|
+
|
23
24
|
@connection.close if @connection
|
24
25
|
raise e
|
25
26
|
end
|
26
27
|
|
27
28
|
begin
|
28
29
|
@channel = @connection.create_channel
|
30
|
+
@channel.on_error do |ch, method|
|
31
|
+
logf "ERROR On RabbitMQ channel: #{method.inspect}"
|
32
|
+
end
|
29
33
|
rescue => e
|
30
|
-
logf "ERROR Opening RabbitMQ channel",
|
34
|
+
logf "ERROR Opening RabbitMQ channel: #{e}", at: :error
|
31
35
|
@connection.close if @connection
|
32
36
|
raise e
|
33
37
|
end
|
@@ -81,14 +85,13 @@ module Pwwka
|
|
81
85
|
begin
|
82
86
|
channel.close
|
83
87
|
rescue => e
|
84
|
-
logf "ERROR Closing RabbitMQ channel",
|
85
|
-
raise e
|
88
|
+
logf "ERROR Closing RabbitMQ channel: #{e}", at: :error
|
86
89
|
end
|
87
90
|
|
88
91
|
begin
|
89
92
|
connection.close
|
90
93
|
rescue => e
|
91
|
-
logf "ERROR Closing connection to RabbitMQ",
|
94
|
+
logf "ERROR Closing connection to RabbitMQ: #{e}", at: :error
|
92
95
|
raise e
|
93
96
|
end
|
94
97
|
end
|
data/lib/pwwka/version.rb
CHANGED
@@ -14,6 +14,7 @@ describe Pwwka::ChannelConnector do
|
|
14
14
|
allow(bunny_session).to receive(:start)
|
15
15
|
allow(bunny_session).to receive(:close)
|
16
16
|
allow(bunny_session).to receive(:create_channel).and_return(bunny_channel)
|
17
|
+
allow(bunny_channel).to receive(:on_error)
|
17
18
|
end
|
18
19
|
|
19
20
|
it "sets a prefetch value if configured to do so" do
|
@@ -22,6 +23,11 @@ describe Pwwka::ChannelConnector do
|
|
22
23
|
described_class.new(prefetch: 10)
|
23
24
|
end
|
24
25
|
|
26
|
+
it "sets an on_error handler" do
|
27
|
+
expect(bunny_channel).to receive(:on_error)
|
28
|
+
described_class.new
|
29
|
+
end
|
30
|
+
|
25
31
|
it "does not set a prefetch value unless configured" do
|
26
32
|
expect(bunny_channel).not_to receive(:prefetch).with(10)
|
27
33
|
|
@@ -67,10 +73,14 @@ describe Pwwka::ChannelConnector do
|
|
67
73
|
end
|
68
74
|
|
69
75
|
describe "raise_if_delayed_not_allowed" do
|
76
|
+
let(:bunny_channel) { instance_double(Bunny::Channel) }
|
77
|
+
|
70
78
|
before do
|
71
79
|
allow(Bunny).to receive(:new).and_return(bunny_session)
|
72
80
|
allow(bunny_session).to receive(:start)
|
73
|
-
allow(bunny_session).to receive(:
|
81
|
+
allow(bunny_session).to receive(:close)
|
82
|
+
allow(bunny_session).to receive(:create_channel).and_return(bunny_channel)
|
83
|
+
allow(bunny_channel).to receive(:on_error)
|
74
84
|
@default_allow_delayed = Pwwka.configuration.options[:allow_delayed]
|
75
85
|
end
|
76
86
|
|