Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* Fixes zalando#1130

Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
  • Loading branch information
neelasha-09 and FxKu authored Sep 22, 2020
1 parent d09e418 commit ab95eaa
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/cluster/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -696,12 +696,8 @@ func (c *Cluster) syncPreparedDatabases() error {
if err := c.initDbConnWithName(preparedDbName); err != nil {
return fmt.Errorf("could not init connection to database %s: %v", preparedDbName, err)
}
defer func() {
if err := c.closeDbConn(); err != nil {
c.logger.Errorf("could not close database connection: %v", err)
}
}()

c.logger.Debugf("syncing prepared database %q", preparedDbName)
// now, prepare defined schemas
preparedSchemas := preparedDB.PreparedSchemas
if len(preparedDB.PreparedSchemas) == 0 {
Expand All @@ -715,6 +711,10 @@ func (c *Cluster) syncPreparedDatabases() error {
if err := c.syncExtensions(preparedDB.Extensions); err != nil {
return err
}

if err := c.closeDbConn(); err != nil {
c.logger.Errorf("could not close database connection: %v", err)
}
}

return nil
Expand Down

0 comments on commit ab95eaa

Please sign in to comment.