Skip to content

Commit

Permalink
Catch errors during shutdown to suppress extra errors in Sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Jan 15, 2025
1 parent 56770c8 commit 4ab9b2c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions neon_mq_connector/consumers/blocking_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ def _close_connection(self):
raise RuntimeError(f"Connection still open: {self.connection}")
except pika.exceptions.StreamLostError:
pass
except AttributeError:
# This happens regularly during connection close within `pika`
pass
except Exception as e:
LOG.exception(f"Failed to close connection due to unexpected exception: {e}")
self._consumer_started.clear()
Expand Down

0 comments on commit 4ab9b2c

Please sign in to comment.