From f432b9d29b8e563f63f95be34da39fc23e9d059f Mon Sep 17 00:00:00 2001 From: Jonathan Boulle Date: Fri, 3 Oct 2014 13:47:34 -0700 Subject: [PATCH] etcdhttp: remove configurable timeout It's slightly unclear why we expose this timeout as being configurable, and the `-timeout` flag does not exist in 0.4.x, so for now, remove the flag until we have evidence that it is needed. --- etcdserver/etcdhttp/http.go | 7 ++----- etcdserver/etcdhttp/http_test.go | 2 +- main.go | 4 +--- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/etcdserver/etcdhttp/http.go b/etcdserver/etcdhttp/http.go index 353cdb16b..21ed439bc 100644 --- a/etcdserver/etcdhttp/http.go +++ b/etcdserver/etcdhttp/http.go @@ -35,15 +35,12 @@ const ( var errClosed = errors.New("etcdhttp: client closed connection") // NewClientHandler generates a muxed http.Handler with the given parameters to serve etcd client requests. -func NewClientHandler(server *etcdserver.EtcdServer, timeout time.Duration) http.Handler { +func NewClientHandler(server *etcdserver.EtcdServer) http.Handler { sh := &serverHandler{ server: server, clusterStore: server.ClusterStore, timer: server, - timeout: timeout, - } - if sh.timeout == 0 { - sh.timeout = defaultServerTimeout + timeout: defaultServerTimeout, } mux := http.NewServeMux() mux.HandleFunc(keysPrefix, sh.serveKeys) diff --git a/etcdserver/etcdhttp/http_test.go b/etcdserver/etcdhttp/http_test.go index 9fc149669..48fa604f6 100644 --- a/etcdserver/etcdhttp/http_test.go +++ b/etcdserver/etcdhttp/http_test.go @@ -591,7 +591,7 @@ func TestV2MachinesEndpoint(t *testing.T) { {"POST", http.StatusMethodNotAllowed}, } - m := NewClientHandler(&etcdserver.EtcdServer{ClusterStore: &fakeCluster{}}, time.Hour) + m := NewClientHandler(&etcdserver.EtcdServer{ClusterStore: &fakeCluster{}}) s := httptest.NewServer(m) defer s.Close() diff --git a/main.go b/main.go index 645031277..2ff66f13c 100644 --- a/main.go +++ b/main.go @@ -7,7 +7,6 @@ import ( "net/http" "os" "strings" - "time" "github.com/coreos/etcd/etcdserver" "github.com/coreos/etcd/etcdserver/etcdhttp" @@ -27,7 +26,6 @@ const ( var ( name = flag.String("name", "default", "Unique human-readable name for this node") - timeout = flag.Duration("timeout", 10*time.Second, "Request Timeout") dir = flag.String("data-dir", "", "Path to the data directory") snapCount = flag.Uint64("snapshot-count", etcdserver.DefaultSnapCount, "Number of committed transactions to trigger a snapshot") printVersion = flag.Bool("version", false, "Print the version and exit") @@ -150,7 +148,7 @@ func startEtcd() { s.Start() ch := &pkg.CORSHandler{ - Handler: etcdhttp.NewClientHandler(s, *timeout), + Handler: etcdhttp.NewClientHandler(s), Info: cors, } ph := etcdhttp.NewPeerHandler(s)