Skip to content

Commit

Permalink
close influxdb clients (influxdata#993)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathaniel Cook authored Oct 25, 2016
1 parent 7c0e6d5 commit f782be9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions influxdb/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type Client interface {
type ClientUpdater interface {
Client
Update(new Config) error
Close() error
}

// BatchPointsConfig is the config data needed to create an instance of the BatchPoints struct
Expand Down Expand Up @@ -173,6 +174,10 @@ func (c *HTTPClient) loadHTTPClient() *http.Client {
return client
}

func (c *HTTPClient) Close() error {
return nil
}

// UpdateURLs updates the running list of URLs.
func (c *HTTPClient) Update(new Config) error {
if new.UserAgent == "" {
Expand Down
2 changes: 1 addition & 1 deletion services/influxdb/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ func (c *influxdbCluster) Close() error {
if c.subSyncTicker != nil {
c.subSyncTicker.Stop()
}

c.client.Close()
return c.closeServices()
}

Expand Down
4 changes: 4 additions & 0 deletions services/influxdb/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,10 @@ type influxDBClient struct {
UpdateFunc func(influxcli.Config) error
}

func (c influxDBClient) Close() error {
return nil
}

func (c influxDBClient) Ping(ctx context.Context) (time.Duration, string, error) {
if c.PingFunc != nil {
return c.PingFunc(ctx)
Expand Down

0 comments on commit f782be9

Please sign in to comment.