Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

registry: use etcd.Config.HeaderTimeoutPerRequest instead of internal timeout #1580

Merged
merged 1 commit into from
May 19, 2016

Conversation

dongsupark
Copy link

As etcd's keysAPI already supports HeaderTimeoutPerRequest, fleet should not handle request timeout on its own, but just pass on the timeout value to the etcd client. For that, set timeout only in etcd.Config.HeaderTimeoutPerRequest, and get rid of internal timeout handling from both EtcdRegistry and LeaseManager.

Suggested-by @jonboulle
Partially resolves #1397

keyPrefix string
reqTimeout time.Duration
kAPI etcd.KeysAPI
keyPrefix string
}

func (r *EtcdRegistry) ctx() context.Context {
Copy link
Contributor

Choose a reason for hiding this comment

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

This function doesn't add much value anymore - how about just inlining context.Background where it's called instead?

@jonboulle
Copy link
Contributor

awesome! One minor comment, LGTM other than that

… timeout

As etcd's keysAPI already supports HeaderTimeoutPerRequest, fleet should
not handle request timeout on its own, but just pass on the timeout
value to the etcd client. For that, set timeout only in
etcd.Config.HeaderTimeoutPerRequest, and get rid of internal timeout
handling from both EtcdRegistry and LeaseManager.

Also remove EtcdRegistry.ctx(), and just call context.Background()
directly, as suggested by Jon.

Suggested-by: Jonathan Boulle <[email protected]>
Partially resolves coreos#1397
@dongsupark dongsupark force-pushed the dongsu/etcd-request-timeout branch from e657804 to 36094ff Compare May 18, 2016 14:02
@dongsupark
Copy link
Author

@jonboulle Done. I removed EtcdRegistry.ctx() to just call context.Background()
directly.

@dongsupark dongsupark merged commit 1882d3c into coreos:master May 19, 2016
@dongsupark
Copy link
Author

Merged #1580. Thanks.

@dongsupark dongsupark deleted the dongsu/etcd-request-timeout branch May 19, 2016 15:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need way to set HeaderTimeoutPerRequest
2 participants