twingly-amqp 6.3.0 → 6.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c1cb941ad372e8cbb085f91beeb5c2131411c17555b86ec3271125203c98003c
4
- data.tar.gz: d00eaff0d89a543c856bef71e7d1e0f034681655a9d97fdcbeb13fa4934f8670
3
+ metadata.gz: 22f68bea1937074e780202bd8bc23dd73309403d1c185ab8b401820b312bb067
4
+ data.tar.gz: ba7c0073d34cf169c7265e62efcef171a3aa5a425f6fce70374788c578db3e8d
5
5
  SHA512:
6
- metadata.gz: 5b2df6c205c407815c1ed2bb4274655d4c427752190907e32a6e0cc2705761a203b939ac547cca7f3269dc9c7f4151038e637113b6c71cfd3cbc88d6d367a27a
7
- data.tar.gz: 1357bef533943bacd3c33d856c774937de795da751a6adfa1af4f57f081dae75e2f6811f2235c4a5b307ccdc24457aa12467d0c5dc6d78b07c0a43d66fdd6d0f
6
+ metadata.gz: 80e8d58eccf8b94a7a00c0f3b81eb207621a6cde71f7751da453c1501aaca2eb194b6685e7ad2258217425383d76a2e18484d52a0d7fa1a2a90446c8369bab85
7
+ data.tar.gz: c755621c4cf4a3e49e48e458192716c64711d32faca5b1508843f6f29ea07c61d0ceb5e37ebb525e162ee4e8e3ece6538adf376b6c792fd76dcec1946e9d7222
@@ -13,6 +13,7 @@ module Twingly
13
13
 
14
14
  json_payload = payload.to_json
15
15
  publishing_options = options.to_h.merge(opts)
16
+ Utilities.raise_if_connection_failed(@exchange.channel.connection)
16
17
  @exchange.publish(json_payload, publishing_options)
17
18
  end
18
19
 
@@ -39,10 +39,14 @@ module Twingly
39
39
 
40
40
  def each_message(blocking: true, &block)
41
41
  @blocking = blocking
42
+ Utilities.raise_if_connection_failed(@channel.connection)
42
43
  @consumer = create_consumer(&block)
43
44
 
44
45
  if @blocking
45
- sleep 0.01 until cancel?
46
+ until cancel?
47
+ Utilities.raise_if_connection_failed(@channel.connection)
48
+ sleep 0.01
49
+ end
46
50
 
47
51
  @consumer.cancel
48
52
  end
@@ -16,6 +16,19 @@ module Twingly
16
16
  end
17
17
  end
18
18
  end
19
+
20
+ # Bunny 3 stores errors that stop its reader loop instead of raising them, so a dead
21
+ # connection still looks open. The error is left in place so every caller fails, and a
22
+ # copy is raised so each one gets its own backtrace.
23
+ def self.raise_if_connection_failed(connection)
24
+ return unless defined?(Bunny::ExceptionAccumulator) && connection.respond_to?(:session_error_handler)
25
+
26
+ handler = connection.session_error_handler
27
+ return unless handler.is_a?(Bunny::ExceptionAccumulator)
28
+
29
+ error = handler.all.first
30
+ raise error.dup if error
31
+ end
19
32
  end
20
33
  end
21
34
  end
@@ -1,5 +1,5 @@
1
1
  module Twingly
2
2
  module Amqp
3
- VERSION = "6.3.0".freeze
3
+ VERSION = "6.4.0".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twingly-amqp
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.3.0
4
+ version: 6.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Twingly AB