pwwka 0.22.3 → 0.22.4

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: 2671782bb95ef71a6afbe4908d3652238dbb801091b9fce6823e9f7a7061750c
4
- data.tar.gz: 6c44c128ea03d6ffb0d9858bf56c4b38ac004f829167761549f3051a82903c48
3
+ metadata.gz: 4360e4e1bf6417591a5a20093a59b955c74b0dee9d620b6c517818535b26e4a4
4
+ data.tar.gz: 21599e4304fc3dd70ca7da613bf58d0eb91011b7cbf857713337cd4f65b37f16
5
5
  SHA512:
6
- metadata.gz: d88737eeed3ecb7b8eeab1a174dc574dbf38755cae27a374d2cb20841e157e05cc971c5467f81b227cc14389b2b89381da15902de67b5118b498f026b4c5d7a5
7
- data.tar.gz: c414a254d881bbf7723ec31a94cfea7f5d46a4d2afc7f527c8e2b4d1d5c02a92d663ec12f422fa444c47e8950edb130285c5c057364b83b2bb70b39b6ed58bd2
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", error: e
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", error: e
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", error: e
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", error: e
94
+ logf "ERROR Closing connection to RabbitMQ: #{e}", at: :error
92
95
  raise e
93
96
  end
94
97
  end
@@ -1,4 +1,4 @@
1
1
  module Pwwka
2
- VERSION = '0.22.3'
2
+ VERSION = '0.22.4'
3
3
  end
4
4
 
@@ -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(:create_channel)
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pwwka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.3
4
+ version: 0.22.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stitch Fix Engineering