Skip to content
Snippets Groups Projects
Commit 87a379f6 authored by Oleksii Kliukin's avatar Oleksii Kliukin Committed by GitHub
Browse files

Avoid reusing closed DB connection. (#79)

Set DB connection to nil upon closing it.
parent f15f93f4
No related branches found
No related tags found
No related merge requests found
...@@ -64,7 +64,10 @@ func (c *Cluster) initDbConn() (err error) { ...@@ -64,7 +64,10 @@ func (c *Cluster) initDbConn() (err error) {
func (c *Cluster) closeDbConn() (err error) { func (c *Cluster) closeDbConn() (err error) {
if c.pgDb != nil { if c.pgDb != nil {
c.logger.Debug("closing database connection") 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") c.logger.Warning("attempted to close an empty db connection object")
return nil return nil
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment