Browse Source

Merge pull request #2034 from yichengq/276

etcdhttp: reset serve and watch timeout
Yicheng Qin 11 years ago
parent
commit
cb5bff5b05
1 changed files with 6 additions and 2 deletions
  1. 6 2
      etcdserver/etcdhttp/http.go

+ 6 - 2
etcdserver/etcdhttp/http.go

@@ -19,6 +19,7 @@ package etcdhttp
 import (
 	"errors"
 	"log"
+	"math"
 	"net/http"
 	"strings"
 	"time"
@@ -29,10 +30,13 @@ import (
 
 const (
 	// time to wait for response from EtcdServer requests
-	defaultServerTimeout = 5 * time.Minute
+	// 5s for disk and network delay + 10*heartbeat for commit and possible
+	// leader switch
+	// TODO: use heartbeat set in etcdserver
+	defaultServerTimeout = 5*time.Second + 10*(100*time.Millisecond)
 
 	// time to wait for a Watch request
-	defaultWatchTimeout = 5 * time.Minute
+	defaultWatchTimeout = time.Duration(math.MaxInt64)
 )
 
 var errClosed = errors.New("etcdhttp: client closed connection")