Default minRequestTimeout to 1800s

This commit is contained in:
Prashanth Balasubramanian
2015-05-28 15:50:39 -07:00
parent f7c0f1c1e3
commit 0162529ea5
3 changed files with 4 additions and 4 deletions

View File

@@ -69,8 +69,8 @@ func (w *realTimeoutFactory) TimeoutCh() (<-chan time.Time, func() bool) {
func serveWatch(watcher watch.Interface, scope RequestScope, w http.ResponseWriter, req *restful.Request, minRequestTimeout int) {
var timeout time.Duration
if minRequestTimeout > 0 {
// Each watch gets a random timeout to avoid thundering herds. Rand is seeded once in the api installer.
timeout = time.Duration(minRequestTimeout+rand.Intn(2*minRequestTimeout-minRequestTimeout)) * time.Second
// Each watch gets a random timeout between minRequestTimeout and 2*minRequestTimeout to avoid thundering herds.
timeout = time.Duration(minRequestTimeout+rand.Intn(minRequestTimeout)) * time.Second
}
watchServer := &WatchServer{watcher, scope.Codec, func(obj runtime.Object) {
if err := setSelfLink(obj, req, scope.Namer); err != nil {