While restoring the database connections due to lost server connection, ensure that the databases which were previously connected are only reconnected. #5919

This commit is contained in:
Yogesh Mahajan 2023-03-24 14:33:45 +05:30 committed by GitHub
parent 5cb64f7602
commit f1aa82ad36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -111,15 +111,16 @@ class ServerHeartbeatTimer():
def _release_connections(server_conn, sess_id, sid):
for d in server_conn:
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))
# Release the connection only if it is connected
if server_conn[d].wasConnected:
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)