Skip to content

Commit

Permalink
fix (StompMQConnector): add a timeout for the StompConnector
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuwd committed Oct 23, 2024
1 parent 56268a1 commit f3df507
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/DIRAC/Resources/MessageQueue/StompMQConnector.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class StompMQConnector(MQConnector):
RECONNECT_SLEEP_MAX = 120 # [s] The maximum delay that can be reached independent of increasing procedure.
RECONNECT_SLEEP_JITTER = 0.1 # Random factor to add. 0.1 means a random number from 0 to 10% of the current time.
RECONNECT_ATTEMPTS_MAX = 1e4 # Maximum attempts to reconnect.
STOMP_TIMEOUT = 60

PORT = 61613

Expand Down Expand Up @@ -72,6 +73,8 @@ def setupConnection(self, parameters=None):
reconnectSleepJitter = self.parameters.get("ReconnectSleepJitter", StompMQConnector.RECONNECT_SLEEP_JITTER)
reconnectAttemptsMax = self.parameters.get("ReconnectAttemptsMax", StompMQConnector.RECONNECT_ATTEMPTS_MAX)

stompTimeout = self.parameters.get("Timeout", StompMQConnector.STOMP_TIMEOUT)

host = self.parameters.get("Host")
port = self.parameters.get("Port", StompMQConnector.PORT)
vhost = self.parameters.get("VHost")
Expand All @@ -83,6 +86,7 @@ def setupConnection(self, parameters=None):
connectionArgs = {
"vhost": vhost,
"keepalive": True,
"timeout": stompTimeout,
"reconnect_sleep_initial": reconnectSleepInitial,
"reconnect_sleep_increase": reconnectSleepIncrease,
"reconnect_sleep_max": reconnectSleepMax,
Expand Down

0 comments on commit f3df507

Please sign in to comment.