Make the heartbeat normal thread to the daemon thread. #5567

This commit is contained in:
Khushboo Vashi 2023-01-24 17:22:29 +05:30 committed by GitHub
parent a7cf698d09
commit 7dc0c1d05c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,6 +57,7 @@ class ServerHeartbeatTimer():
self.t.start()
self.release_server_heartbeat()
self.t = threading.Timer(sec, func_wrapper)
self.t.daemon = True
self.t.start()
self._app = _app
@ -87,15 +88,18 @@ class ServerHeartbeatTimer():
@staticmethod
def _release_connections(server_conn, sess_id, sid):
for d in server_conn:
# Release the connection
server_conn[d]._release()
# Reconnect on the reload
server_conn[d].wasConnected = True
current_app.logger.debug(
"Heartbeat not received. Released "
"connection for the session "
"id##server id: {0}##{1}".format(
sess_id, sid))
try:
# Release the connection
server_conn[d]._release()
# Reconnect on the reload
server_conn[d].wasConnected = True
current_app.logger.debug(
"Heartbeat not received. Released "
"connection for the session "
"id##server id: {0}##{1}".format(
sess_id, sid))
except Exception as e:
current_app.logger.exception(e)
def cancel(self):
self.t.cancel()