Fix rare exception during shutdown in airtime_analyzer
This commit is contained in:
parent
82f251f061
commit
54523e264c
1 changed files with 7 additions and 2 deletions
|
@ -120,7 +120,12 @@ class MessageListener:
|
|||
|
||||
def disconnect_from_messaging_server(self):
|
||||
'''Stop consuming RabbitMQ messages and disconnect'''
|
||||
# If you try to close a connection that's already closed, you're going to have a bad time.
|
||||
# We're breaking EAFP because this can be called multiple times depending on exception
|
||||
# handling flow here.
|
||||
if not self._channel.is_closed and not self._channel.is_closing:
|
||||
self._channel.stop_consuming()
|
||||
if not self._connection.is_closed and not self._connection.is_closing:
|
||||
self._connection.close()
|
||||
|
||||
def graceful_shutdown(self, signum, frame):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue