@@ -70,6 +70,7 @@ class GRIDAPPSD_ENV_ENUM(Enum):
7070 GRIDAPPSD_ADDRESS = "GRIDAPPSD_ADDRESS"
7171 GRIDAPPSD_PORT = "GRIDAPPSD_PORT"
7272 GRIDAPPSD_PASS = "GRIDAPPSD_PASSWORD"
73+ GRIDAPPSD_HEARTBEAT = "GRIDAPPSD_HEARTBEAT"
7374
7475
7576class TimeoutError (Exception ):
@@ -119,6 +120,8 @@ def __init__(self,
119120
120121 if not self .__user__ or not self .__pass__ :
121122 raise ValueError ("Invalid username/password specified." )
123+
124+ self ._heartbeat = int (os .environ .get (GRIDAPPSD_ENV_ENUM .GRIDAPPSD_HEARTBEAT .value , 4000 ))
122125 self ._conn = None
123126 self ._ids = set ()
124127 self ._topic_set = set ()
@@ -306,7 +309,7 @@ def _make_connection(self):
306309 # send request to token topic
307310 tokenTopic = "/topic/pnnl.goss.token.topic"
308311
309- tmpConn = Connection ([(self .stomp_address , self .stomp_port )])
312+ tmpConn = Connection ([(self .stomp_address , self .stomp_port )], heartbeats = ( self . _heartbeat , self . _heartbeat ) )
310313 if self ._override_thread_fc is not None :
311314 tmpConn .transport .override_threading (self ._override_thread_fc )
312315 tmpConn .connect (self .__user__ , self .__pass__ , wait = True )
@@ -349,7 +352,7 @@ def on_disconnect(self, header, message):
349352 sleep (1 )
350353 iter += 1
351354
352- self ._conn = Connection ([(self .stomp_address , self .stomp_port )])
355+ self ._conn = Connection ([(self .stomp_address , self .stomp_port )], heartbeats = ( self . _heartbeat , self . _heartbeat ) )
353356 if self ._override_thread_fc is not None :
354357 self ._conn .transport .override_threading (self ._override_thread_fc )
355358 try :
0 commit comments