Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kirgrim committed Nov 24, 2024
1 parent f9b96b2 commit bc08ce4
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions neon_mq_connector/consumers/blocking_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,12 @@ def run(self):
self._is_consuming = True
self.channel.start_consuming()
except Exception as e:
if isinstance(e, pika.exceptions.ChannelClosed):
LOG.error(f"Channel closed by broker: {self.callback_func}")
self.error_func(self, e)
elif isinstance(e, pika.exceptions.StreamLostError):
LOG.info(f"Received connection close: {e}")
else:
LOG.error(f"Unexpected error: {e}")
self.error_func(self, e)
self.join(allow_restart=True)

def join(self, timeout: Optional[float] = ..., allow_restart: bool = True) -> None:
"""Terminating consumer channel"""
if self._is_consumer_alive and self._is_consuming:
if self.is_consumer_alive and self.is_consuming:
self._is_consuming = False
try:
self.channel.stop_consuming()
Expand Down

0 comments on commit bc08ce4

Please sign in to comment.