Drop a python 2 exception management
Previously (when python 2 was supported) we introduced some specific
exception management to detect connections issues when a rabbitmq
cluster node disappearing.
The original issue was that a ConnectionRefusedError is thrown and not
managed by oslo.messaging to detect heartbeat issue and call ensure_connection
for switching the connection destination (cluster node).
`ConnectionRefusedError` is only a python 3 exception [2].
Now that we only support python 3 we don't need to continue to
wrap/emulate this kind of exceptions (ConnectionRefusedError) [2] and
so we can drop the python 2 compatibility code to only support python 3 code.
[1] 9d8b1430e5
[2] https://docs.python.org/3/library/exceptions.html#ConnectionRefusedError
Change-Id: I4c459d8c947dac213a1866c0d37e8f3d547aa82e
This commit is contained in:
parent
c2074e4760
commit
661bdd7f41
@ -975,13 +975,6 @@ class Connection(object):
|
||||
def _heartbeat_thread_job(self):
|
||||
"""Thread that maintains inactive connections
|
||||
"""
|
||||
# NOTE(hberaud): Python2 doesn't have ConnectionRefusedError
|
||||
# defined so to switch connections destination on failure
|
||||
# with python2 and python3 we need to wrapp adapt connection refused
|
||||
try:
|
||||
ConnectRefuseError = ConnectionRefusedError
|
||||
except NameError:
|
||||
ConnectRefuseError = socket.error
|
||||
|
||||
while not self._heartbeat_exit_event.is_set():
|
||||
with self._connection_lock.for_heartbeat():
|
||||
@ -1008,7 +1001,7 @@ class Connection(object):
|
||||
# ensure_connection for switching the
|
||||
# connection destination.
|
||||
except (socket.timeout,
|
||||
ConnectRefuseError,
|
||||
ConnectionRefusedError,
|
||||
OSError,
|
||||
kombu.exceptions.OperationalError) as exc:
|
||||
LOG.info("A recoverable connection/channel error "
|
||||
|
Loading…
x
Reference in New Issue
Block a user