bunny 2.20.3 → 2.21.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 +4 -4
- data/lib/bunny/consumer_work_pool.rb +1 -1
- data/lib/bunny/session.rb +18 -13
- data/lib/bunny/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a51dd17b606b2363463849ba249e8bdff82f263237304def85c72d804a72cf9f
|
4
|
+
data.tar.gz: fc7754eb6f23de9759b515f9c98800ff24ecc0b1dea4d07a6a04f028362a91f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 522d80a40d4189fe483ad77f213f676afabbf6d27d834ebb84c6cf2c79f11060f11015e0b2fe92cf08e0fa5144244b94f7f36c785db43577722660e216b7039c
|
7
|
+
data.tar.gz: 7d2e4905752d86fadd6ac8d780970c4e8abd622cdb3b93aa94503bc4f03b3c658bbc6901c110bcf1dc16e18610aa2f7e57bae061525eb879b1d2e43ba4a3fcb2
|
@@ -70,7 +70,7 @@ module Bunny
|
|
70
70
|
return if !(wait_for_workers && @shutdown_timeout && was_running)
|
71
71
|
|
72
72
|
@shutdown_mutex.synchronize do
|
73
|
-
@shutdown_conditional.wait(@shutdown_mutex, @shutdown_timeout)
|
73
|
+
@shutdown_conditional.wait(@shutdown_mutex, @shutdown_timeout) if busy?
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
data/lib/bunny/session.rb
CHANGED
@@ -71,6 +71,7 @@ module Bunny
|
|
71
71
|
# Default reconnection interval for TCP connection failures
|
72
72
|
DEFAULT_NETWORK_RECOVERY_INTERVAL = 5.0
|
73
73
|
|
74
|
+
DEFAULT_RECOVERABLE_EXCEPTIONS = [StandardError, TCPConnectionFailedForAllHosts, TCPConnectionFailed, AMQ::Protocol::EmptyResponseError, SystemCallError, Timeout::Error, Bunny::ConnectionLevelException, Bunny::ConnectionClosedError]
|
74
75
|
|
75
76
|
#
|
76
77
|
# API
|
@@ -91,6 +92,7 @@ module Bunny
|
|
91
92
|
attr_reader :network_recovery_interval
|
92
93
|
attr_reader :connection_name
|
93
94
|
attr_accessor :socket_configurator
|
95
|
+
attr_accessor :recoverable_exceptions
|
94
96
|
|
95
97
|
# @param [String, Hash] connection_string_or_opts Connection string or a hash of connection options
|
96
98
|
# @param [Hash] optz Extra options not related to connection
|
@@ -226,6 +228,8 @@ module Bunny
|
|
226
228
|
|
227
229
|
@session_error_handler = opts.fetch(:session_error_handler, Thread.current)
|
228
230
|
|
231
|
+
@recoverable_exceptions = DEFAULT_RECOVERABLE_EXCEPTIONS.dup
|
232
|
+
|
229
233
|
self.reset_continuations
|
230
234
|
self.initialize_transport
|
231
235
|
|
@@ -747,9 +751,7 @@ module Bunny
|
|
747
751
|
|
748
752
|
# @private
|
749
753
|
def recoverable_network_failure?(exception)
|
750
|
-
|
751
|
-
# So just recover unconditionally. MK.
|
752
|
-
true
|
754
|
+
@recoverable_exceptions.any? {|x| exception.kind_of? x}
|
753
755
|
end
|
754
756
|
|
755
757
|
# @private
|
@@ -794,19 +796,22 @@ module Bunny
|
|
794
796
|
rescue HostListDepleted
|
795
797
|
reset_address_index
|
796
798
|
retry
|
797
|
-
rescue
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
799
|
+
rescue => e
|
800
|
+
if recoverable_network_failure?(e)
|
801
|
+
@logger.warn "TCP connection failed"
|
802
|
+
if should_retry_recovery?
|
803
|
+
@logger.warn "Reconnecting in #{@network_recovery_interval} seconds"
|
804
|
+
decrement_recovery_attemp_counter!
|
802
805
|
announce_network_failure_recovery
|
803
806
|
retry
|
807
|
+
else
|
808
|
+
@logger.error "Ran out of recovery attempts (limit set to #{@max_recovery_attempts}), giving up"
|
809
|
+
@transport.close
|
810
|
+
self.close(false)
|
811
|
+
@manually_closed = false
|
804
812
|
end
|
805
813
|
else
|
806
|
-
|
807
|
-
@transport.close
|
808
|
-
self.close(false)
|
809
|
-
@manually_closed = false
|
814
|
+
raise e
|
810
815
|
end
|
811
816
|
end
|
812
817
|
|
@@ -1356,7 +1361,7 @@ module Bunny
|
|
1356
1361
|
host_from_address(address),
|
1357
1362
|
port_from_address(address),
|
1358
1363
|
@opts.merge(:session_error_handler => @session_error_handler)
|
1359
|
-
|
1364
|
+
)
|
1360
1365
|
|
1361
1366
|
# Reset the cached progname for the logger only when no logger was provided
|
1362
1367
|
@default_logger.progname = self.to_s
|
data/lib/bunny/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bunny
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Duncan
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2023-
|
15
|
+
date: 2023-06-08 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: amq-protocol
|
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
- !ruby/object:Gem::Version
|
121
121
|
version: '0'
|
122
122
|
requirements: []
|
123
|
-
rubygems_version: 3.
|
123
|
+
rubygems_version: 3.4.6
|
124
124
|
signing_key:
|
125
125
|
specification_version: 4
|
126
126
|
summary: Popular easy to use Ruby client for RabbitMQ
|