We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 575fc21 + 69c07d6 commit 16c7d80Copy full SHA for 16c7d80
dj_cqrs/transport/rabbit_mq.py
@@ -28,8 +28,12 @@ class RabbitMQTransport(LoggingMixin, BaseTransport):
28
29
@classmethod
30
def clean_connection(cls):
31
- if cls._producer_connection and not cls._producer_connection.is_closed:
32
- cls._producer_connection.close()
+ connection = cls._producer_connection
+ if connection and not connection.is_closed:
33
+ try:
34
+ connection.close()
35
+ except (exceptions.StreamLostError, exceptions.ConnectionClosed, ConnectionError):
36
+ logger.warning("Connection was closed or is closing. Skip it...")
37
38
cls._producer_connection = None
39
cls._producer_channel = None
0 commit comments