Browse Source

leasehttp: buffer error channel to prevent goroutine leak

fanmin shi 9 years ago
parent
commit
7b7feb46fc
1 changed files with 2 additions and 1 deletions
  1. 2 1
      lease/leasehttp/http.go

+ 2 - 1
lease/leasehttp/http.go

@@ -206,7 +206,8 @@ func TimeToLiveHTTP(ctx context.Context, id lease.LeaseID, keys bool, url string
 
 
 	cc := &http.Client{Transport: rt}
 	cc := &http.Client{Transport: rt}
 	var b []byte
 	var b []byte
-	errc := make(chan error)
+	// buffer errc channel so that errc don't block inside the go routinue
+	errc := make(chan error, 2)
 	go func() {
 	go func() {
 		resp, err := cc.Do(req)
 		resp, err := cc.Do(req)
 		if err != nil {
 		if err != nil {