Better handle pika connection errors

It seems like pika may raise AttributeError when the connection is closed,
as describe here: https://github.com/pika/pika/issues/638, resulting
in this error displayed on the webclient:
500: POST /storyboard_api/tasks: 'NoneType' object has no attribute 'send'

This change adds AttributeError to the ConnectionClosed except.

Change-Id: Iffa1ef1998379097b32d699a360b5de9277c01ed
This commit is contained in:
Tristan Cacqueray 2017-07-11 03:04:23 +00:00
parent 197fdd795f
commit ca537c255a
1 changed files with 1 additions and 1 deletions

View File

@ -103,7 +103,7 @@ class Publisher(ConnectionService):
if payload in self._pending:
self._pending.remove(payload)
return True
except ConnectionClosed as cc:
except (ConnectionClosed, AttributeError) as cc:
LOG.warning(_LW("Attempted to send message on closed connection."))
LOG.debug(cc)
self._open = False