Skip to content

Commit

Permalink
Update StreamLost handling from error to warning to prevent non-actio…
Browse files Browse the repository at this point in the history
…nable errors

Refactor connection close error log to accurately state "closed" instead of "closing"
https://neon-ai.sentry.io/issues/6117742740/events/8741afbd379f439a843d69094c0a63fe/
  • Loading branch information
NeonDaniel committed Jan 17, 2025
1 parent 936c3d0 commit 832ae98
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion neon_mq_connector/consumers/select_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,11 @@ def on_close(self, _, e):
self._consumer_started.clear()
if isinstance(e, pika.exceptions.ConnectionClosed):
LOG.info(f"Connection closed normally: {e}")
elif isinstance(e, pika.exceptions.StreamLostError):
LOG.warning("MQ connection lost; "
"RabbitMQ is likely temporarily unavailable.")
else:
LOG.error(f"Closing MQ connection due to exception: {e}")
LOG.error(f"MQ connection closed due to exception: {e}")
if not self._stopping:
# Connection was gracefully closed by the server. Try to re-connect
LOG.info(f"Trying to reconnect after server closed connection")
Expand Down

0 comments on commit 832ae98

Please sign in to comment.