1
0
mirror of https://github.com/prometheus-community/postgres_exporter.git synced 2025-08-08 04:42:07 +03:00

Ensure database connections are always closed (#1177)

Signed-off-by: Sam DeHaan <sam.dehaan@grafana.com>
Signed-off-by: Sam DeHaan <dehaansa@gmail.com>
Co-authored-by: Sam DeHaan <sam.dehaan@grafana.com>
Co-authored-by: Sam DeHaan <dehaansa@gmail.com>
This commit is contained in:
Cristian Greco
2025-07-18 20:53:45 +02:00
committed by GitHub
parent aa98bb30ef
commit 06a553c816
3 changed files with 7 additions and 2 deletions

View File

@@ -173,6 +173,7 @@ func (s *Servers) GetServer(dsn string) (*Server, error) {
s.servers[dsn] = server
}
if err = server.Ping(); err != nil {
server.Close()
delete(s.servers, dsn)
time.Sleep(time.Duration(errCount) * time.Second)
continue