Skip to content

Commit

Permalink
fix panic on closing failed to open influxdbCluster type
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanielc committed Jan 23, 2017
1 parent ad0671f commit 2e29c5d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ See the [API docs on technical preview](https://docs.influxdata.com/kapacitor/v1
- [#1043](https://github.com/influxdata/kapacitor/issues/1043): logrotate.d ignores kapacitor configuration due to bad file mode
- [#1100](https://github.com/influxdata/kapacitor/issues/1100): Fix issue with the Union node buffering more points than necessary.
- [#872](https://github.com/influxdata/kapacitor/issues/872): Fix panic during failed aggregate results.
- [#1087](https://github.com/influxdata/kapacitor/issues/1087): Fix panic during close of failed startup when connecting to InfluxDB.

## v1.1.1 [2016-12-02]

Expand Down
13 changes: 10 additions & 3 deletions services/influxdb/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,6 @@ func (c *influxdbCluster) Open() error {
if c.opened {
return nil
}
c.opened = true

if cli, err := c.ClientCreator.Create(c.influxdbConfig); err != nil {
return errors.Wrap(err, "failed to create client")
Expand All @@ -500,7 +499,13 @@ func (c *influxdbCluster) Open() error {
}

c.watchSubs()
return c.linkSubscriptions(ctx)

if err := c.linkSubscriptions(ctx); err != nil {
return err
}

c.opened = true
return nil
}

func (c *influxdbCluster) Close() error {
Expand All @@ -514,7 +519,9 @@ func (c *influxdbCluster) Close() error {
if c.subSyncTicker != nil {
c.subSyncTicker.Stop()
}
c.client.Close()
if c.client != nil {
c.client.Close()
}
return c.closeServices()
}

Expand Down

0 comments on commit 2e29c5d

Please sign in to comment.