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

HystrixTimeout vs HTTPTimeout #101

Open
v-byte-cpu opened this issue Dec 31, 2020 · 3 comments
Open

HystrixTimeout vs HTTPTimeout #101

v-byte-cpu opened this issue Dec 31, 2020 · 3 comments

Comments

@v-byte-cpu
Copy link

What is the reason to have two timeouts: HystrixTimeout and HTTPTimeout for hystrix.Client ? It seems that two points are valid for current implementation:

  1. timeout field in hystrix.Client is set but never used (maybe bug ?)
  2. If any of the two events (HystrixTimeout or HTTPTimeout) occurs first then request will fail immediately. So if HTTPTimeout < HystrixTimeout, then HystrixTimeout is never used. And if HystrixTimeout < HTTPTimeout then hystrix will return error but goroutine with httpclient.Do will be still in blocking state waiting for response or http timeout (problem in hystrix code).
@milkwine
Copy link

It seems HTTPTimeout not realy affect hystrix.Client.client

func NewClient(opts ...Option) *Client {
client := Client{
client: httpclient.NewClient(),
timeout: defaultHTTPTimeout,
hystrixTimeout: defaultHystrixTimeout,
maxConcurrentRequests: defaultMaxConcurrentRequests,
errorPercentThreshold: defaultErrorPercentThreshold,
sleepWindow: defaultSleepWindow,
requestVolumeThreshold: defaultRequestVolumeThreshold,
retryCount: defaultHystrixRetryCount,
retrier: heimdall.NewNoRetrier(),
}
for _, opt := range opts {
opt(&client)
}

// WithHTTPTimeout sets hystrix timeout
func WithHTTPTimeout(timeout time.Duration) Option {
return func(c *Client) {
c.timeout = timeout
}
}

@Kaustavd
Copy link

I feel there should be 2 different timeouts as within hystrix method there might be other commands also getting executed like http connection setup (if connection is not reused) etc.

@pmitra43
Copy link

pmitra43 commented Dec 8, 2022

client.Timeout is not being passed on to hystrix setup. Ref: https://github.com/gojek/heimdall/blob/master/hystrix/hystrix_client.go#L80

It seems like a duplicate of the httpClient option. Ref: https://github.com/gojek/heimdall/blob/master/httpclient/client.go#L46

Is it safe to remove timeout config from hystrix and the WithHTTPTimeout option?

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

4 participants