Skip to content
Snippets Groups Projects
Commit 03f22413 authored by Nicolas Dandrimont's avatar Nicolas Dandrimont
Browse files

Add some fatal non-fatal errors

parent 17dc4c55
No related tags found
No related merge requests found
......@@ -39,6 +39,14 @@ _SPAMMY_ERRORS = [
KafkaError._NO_OFFSET,
]
# Errors that kafka raises as non-fatal, but that we aren't able to recover from
_FATAL_NONFATAL_ERRORS = [
# Processing exceeded max.poll.interval.ms, the consumer is now disabled
KafkaError._MAX_POLL_EXCEEDED,
# The consumer has exited the consumer group
KafkaError.UNKNOWN_MEMBER_ID,
]
class EofBehavior(enum.Enum):
"""Possible behaviors when reaching the end of the log"""
......@@ -85,8 +93,10 @@ def get_journal_client(cls: str, **kwargs: Any):
def _error_cb(error):
if error.fatal():
raise KafkaException(error)
if error.code() in _SPAMMY_ERRORS:
if (code := error.code()) in _SPAMMY_ERRORS:
logger.debug("Received non-fatal kafka error: %s", error)
elif code in _FATAL_NONFATAL_ERRORS:
raise KafkaException(error)
else:
logger.info("Received non-fatal kafka error: %s", error)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment