Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions ldclient/event_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ def run(self):
log.info("Starting event consumer")
self._running = True
while self._running:
self.send()
try:
self.send()
except Exception:
log.exception(
'Unhandled exception in event consumer')

def stop(self):
self._running = False
Expand All @@ -53,11 +57,12 @@ def do_send(should_retry):
data=json_body)
r.raise_for_status()
except ProtocolError as e:
inner = e.args[1]
if inner.errno == errno.ECONNRESET and should_retry:
log.warning(
'ProtocolError exception caught while sending events. Retrying.')
do_send(False)
if e.args is not None and len(e.args) > 1 and e.args[1] is not None:
inner = e.args[1]
if inner.errno is not None and inner.errno == errno.ECONNRESET and should_retry:
log.warning(
'ProtocolError exception caught while sending events. Retrying.')
do_send(False)
else:
log.exception(
'Unhandled exception in event consumer. Analytics events were not processed.')
Expand Down