mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-09-30 15:06:49 +02:00
Avoid reusing closed DB connection. (#79)
Set DB connection to nil upon closing it.
This commit is contained in:
+4
-1
@@ -64,7 +64,10 @@ func (c *Cluster) initDbConn() (err error) {
|
||||
func (c *Cluster) closeDbConn() (err error) {
|
||||
if c.pgDb != nil {
|
||||
c.logger.Debug("closing database connection")
|
||||
return c.pgDb.Close()
|
||||
if err = c.pgDb.Close(); err != nil {
|
||||
c.logger.Errorf("could not close database connection: %v", err)
|
||||
}
|
||||
c.pgDb = nil
|
||||
}
|
||||
c.logger.Warning("attempted to close an empty db connection object")
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user