in postgresql_metrics/metrics_logic.py [0:0]
def confirm_connections_work(conf, db_connections):
"""Call this to confirm that all connections are still alive before using them.
Will recreate any closed connections."""
confirmed_connections = []
for db_connection in db_connections:
if db_connection.closed:
db_name = get_db_name_from_connection(db_connection)
LOG.warn("database connection is closed to db '{}', reconnecting", db_name)
confirmed_connections.append(connect_to_single_db_with_conf(conf, db_name))
else:
confirmed_connections.append(db_connection)
return confirmed_connections