Skip to content

Commit

Permalink
Troubleshoot duplicated consumers after reconnection
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Feb 8, 2025
1 parent 1c56fbb commit c2a4e96
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions neon_mq_connector/consumers/select_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,14 @@ def on_close(self, _, e):
else:
LOG.error(f"MQ connection closed due to exception: {e}")
if not self._stopping:
if e.reply_code == 320:
LOG.info(f"Server shutdown. Try to reconnect after 60s (t={self.name})")
self.reconnect(60)
else:
# Connection was lost or closed by the server. Try to re-connect
LOG.info(f"Trying to reconnect after server connection loss")
self.reconnect()
LOG.info("Consumer is not stopping. It will reconnect to the server when it becomes available")
# if e.reply_code == 320:
# LOG.info(f"Server shutdown. Try to reconnect after 60s (t={self.name})")
# self.reconnect(60)
# else:
# # Connection was lost or closed by the server. Try to re-connect
# LOG.info(f"Trying to reconnect after server connection loss")
# self.reconnect()

@property
def is_consumer_alive(self) -> bool:
Expand Down

0 comments on commit c2a4e96

Please sign in to comment.