Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

refactored httpclient handling #991

Merged
merged 2 commits into from Dec 4, 2017

Conversation

tgruben
Copy link
Member

@tgruben tgruben commented Dec 1, 2017

Overview

Multiple instances of the standard go http client where not necessary. This refactor limits to only once instance
Fixes #983

Pull request checklist

Code review checklist

This is the checklist that the reviewer will follow while reviewing your pull request. You do not need to do anything with this checklist, but be aware of what the reviewer will be looking for.

  • Ensure that any changes to external docs have been included in this pull request.
  • If the changes require that minor/major versions need to be updated, tag the PR appropriately.
  • Ensure the new code is properly commented and follows Idiomatic Go.
  • Check that tests have been written and that they cover the new functionality.
  • Run tests and ensure they pass.
  • Build and run the code, performing any applicable integration testing.

@tgruben tgruben requested review from yuce and jaffee December 1, 2017 22:08
Copy link
Member

@jaffee jaffee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm other than the comments about newing up clients in tests... merge at your discretion

test/executor.go Outdated
@@ -15,7 +15,7 @@ type Executor struct {
// NewExecutor returns a new instance of Executor.
// The executor always matches the hostname of the first cluster node.
func NewExecutor(holder *pilosa.Holder, cluster *pilosa.Cluster) *Executor {
executor := pilosa.NewExecutor(nil)
executor := pilosa.NewExecutor(pilosa.GetHTTPClient(nil))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be better to use a default client defined at the package level here, so that we aren't newing up lots of new clients while running tests?

@@ -50,7 +50,7 @@ func TestMain_Set_Quick(t *testing.T) {
defer m.Close()

// Create client.
client, err := pilosa.NewInternalHTTPClient(m.Server.URI.HostPort(), nil)
client, err := pilosa.NewInternalHTTPClient(m.Server.URI.HostPort(), pilosa.GetHTTPClient(nil))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be better to use a default client defined at the package level here (and the two other places in this file), so that we aren't newing up lots of new clients while running tests?

@tgruben tgruben merged commit 29aca37 into FeatureBaseDB:master Dec 4, 2017
@tgruben tgruben deleted the single-http-client branch December 4, 2017 18:24
@tgruben tgruben restored the single-http-client branch December 4, 2017 20:57
@codysoyland codysoyland mentioned this pull request Dec 5, 2017
12 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Socket Leak
2 participants