Skip to content

Commit

Permalink
LITE-26790 RMQ Connection is cleaned in any error case
Browse files Browse the repository at this point in the history
  • Loading branch information
maxipavlovic committed Mar 20, 2023
1 parent 65d01a7 commit bf5c760
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dj_cqrs/transport/rabbit_mq.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,12 @@ def _produce_with_retries(cls, payload, retries):
exceptions.ReentrancyError,
AMQPConnectorException,
) as e:
# in case of any error - close connection and try to reconnect
cls.clean_connection()

base_log_message = "CQRS couldn't be published: pk = {0} ({1}).".format(
payload.pk, payload.cqrs_id,
)

if not retries:
logger.exception(base_log_message)
return
Expand All @@ -126,8 +128,6 @@ def _produce_with_retries(cls, payload, retries):
base_log_message, e.__class__.__name__,
))

# in case of any error - close connection and try to reconnect
cls.clean_connection()
cls._produce_with_retries(payload, retries - 1)

@classmethod
Expand Down

0 comments on commit bf5c760

Please sign in to comment.