Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't set client to nil when closing broker #2371

Merged
merged 1 commit into from
Apr 21, 2015
Merged

Don't set client to nil when closing broker #2371

merged 1 commit into from
Apr 21, 2015

Conversation

jwilder
Copy link
Contributor

@jwilder jwilder commented Apr 21, 2015

Fixes 2352

@otoolep
Copy link
Contributor

otoolep commented Apr 21, 2015

This kind of makes sense. Really, isn't the broker type missing an Open call, which should be called before the broker type is used? This seems to be just changing how Close works, when what is missing the Open. Or am I missing something?

@otoolep
Copy link
Contributor

otoolep commented Apr 21, 2015

To be clear, in Open the client would be set to non-nil, it seems to me. This seems a fix to allow a broker object to be re-used after Close() has been called, but that would indicate a broken API. Make sense?

@jwilder
Copy link
Contributor Author

jwilder commented Apr 21, 2015

The client is already created and set when the broker is created here: https://github.com/influxdb/influxdb/blob/master/broker.go#L47

This nil pointer is in the http.Client here: https://github.com/golang/go/blob/release-branch.go1.4/src/net/http/client.go#L304

Since we're using the DefaultTransport and http.Client are supposed to be reused, setting it to nil doesn't make sense.

@otoolep
Copy link
Contributor

otoolep commented Apr 21, 2015

OK, very good -- thanks @jwilder . That was the context I was missing.

+1

jwilder added a commit that referenced this pull request Apr 21, 2015
Don't set client to nil when closing broker
@jwilder jwilder merged commit 9993c0d into master Apr 21, 2015
@jwilder jwilder deleted the 2352 branch April 21, 2015 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants