Skip to content

Commit 28c27ef

Browse files
laiminhtrung1997Trung Minh LaiFxKu
authored
Handle retry connect to Postgres when ping return EOF error. (zalando#2339)
* Handle retry connect to Postgres when ping return EOF error. * Update pkg/cluster/database.go Co-authored-by: Felix Kunde <[email protected]> --------- Co-authored-by: Trung Minh Lai <[email protected]> Co-authored-by: Felix Kunde <[email protected]>
1 parent ccc74ae commit 28c27ef

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/cluster/database.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ func (c *Cluster) initDbConnWithName(dbname string) error {
154154
return false, err2
155155
}
156156

157-
return false, err
157+
// Retry open connection until succeeded.
158+
c.logger.Warningf("could not connect to Postgres database: %v", err)
159+
return false, nil
158160
})
159161

160162
if finalerr != nil {

0 commit comments

Comments
 (0)