Skip to content

Commit

Permalink
Merge pull request #26 from AnirudhGoel/patch-2
Browse files Browse the repository at this point in the history
Do not exit if pgpool is unreachable on startup
  • Loading branch information
pengbo0328 authored Jun 13, 2023
2 parents e76f5f6 + 979dfb6 commit 0dd3da2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pgpool2_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,13 @@ func NewExporter(dsn string, namespace string) *Exporter {

db, err := getDBConn(dsn)

if err != nil {
// If pgpool is down on exporter startup, keep waiting for pgpool to be up
for err != nil {
level.Error(Logger).Log("err", err)
os.Exit(1)
level.Info(Logger).Log("info", "Sleeping for 5 seconds before trying to connect again")
time.Sleep(5 * time.Second)

db, err = getDBConn(dsn)
}

return &Exporter{
Expand Down

0 comments on commit 0dd3da2

Please sign in to comment.