Gracefully handle callback crashes.
This commit is contained in:
parent
2703e444ef
commit
54b0a0aed7
|
@ -329,7 +329,7 @@ class Stream(BasicStream):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _invoke(self, handle, data):
|
def _invoke(self, handle, data):
|
||||||
IOLOG.debug('%r._invoke(): handle=%r; data=%r', self, handle, data)
|
IOLOG.debug('%r._invoke(%r, %r)', self, handle, data)
|
||||||
try:
|
try:
|
||||||
persist, fn = self._context._handle_map[handle]
|
persist, fn = self._context._handle_map[handle]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
@ -337,7 +337,11 @@ class Stream(BasicStream):
|
||||||
|
|
||||||
if not persist:
|
if not persist:
|
||||||
del self._context._handle_map[handle]
|
del self._context._handle_map[handle]
|
||||||
fn(data)
|
|
||||||
|
try:
|
||||||
|
fn(data)
|
||||||
|
except Exception:
|
||||||
|
LOG.debug('%r._invoke(%r, %r): %r crashed', self, handle, data, fn)
|
||||||
|
|
||||||
def on_transmit(self):
|
def on_transmit(self):
|
||||||
"""Transmit buffered messages."""
|
"""Transmit buffered messages."""
|
||||||
|
|
Loading…
Reference in New Issue