2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-25 19:10:10 +00:00

Better handle random exceptions in console plugins

If a console plugin raises some unrecognized exception,
handle it more gracefully with trace log capture and moving
on.
This commit is contained in:
Jarrod Johnson 2015-02-27 12:17:28 -05:00
parent 5137f1881a
commit 48b73f6857

View File

@ -227,6 +227,17 @@ class _ConsoleHandler(object):
if not self.reconnect:
self.reconnect = eventlet.spawn_after(retrytime, self._connect)
return
except Exception:
_tracelog.log(traceback.format_exc(), ltype=log.DataTypes.event,
event=log.Events.stacktrace)
self.error = 'unknown'
self.connectstate = 'unconnected'
self._send_rcpts({'connectstate': self.connectstate,
'error': self.error})
retrytime = 30 + (30 * random.random())
if not self.reconnect:
self.reconnect = eventlet.spawn_after(retrytime, self._connect)
return
self._got_connected()
def _got_connected(self):