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

Support single connection for multiple request #104

Open
irnurzaman opened this issue Jan 23, 2021 · 3 comments
Open

Support single connection for multiple request #104

irnurzaman opened this issue Jan 23, 2021 · 3 comments

Comments

@irnurzaman
Copy link

Is this library support using single connection for multiple request? So it doesn't need handshake process for every request

@lukas016
Copy link

lukas016 commented Mar 18, 2021

you can use custom client:

type client struct {
	client *http.Client
	transport http.RoundTripper
}

func (client *client) Do(request *http.Request) (*http.Response, error) {
	request.Close = false //This will be prevent closing of tcp connection, heimdall sets this attribute on true
	return client.client.Do(request) \
} 

hystrix.NewClient(
		hystrix.WithHTTPTimeout(30*time.Second),
		hystrix.WithHTTPClient(NewClient()) 
	) 

@komalasurya
Copy link

@lukas016 do u know why we close tcp connection after every request instead of reusing it?

@lukas016
Copy link

lukas016 commented Dec 9, 2021

@komalasurya sorry, but i don't use or follow this project anymore. So if my comment above do problem you/i can deleted it. In my use cases i don't need close each connection to server, but heimdall wasn't very well for my use cases and comment above is from one of tests, when it works for me.

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

No branches or pull requests

3 participants