Browse Source

fix retry connection

sainw 3 years ago
parent
commit
c11b2de2f2
1 changed files with 2 additions and 4 deletions
  1. 2 4
      client/client.go

+ 2 - 4
client/client.go

@@ -111,17 +111,15 @@ start:
 		if ok {
 			if statusCode.Code() == codes.Unauthenticated {
 				return nil, err
-			} else if statusCode.Code() == codes.Unavailable {
+			} else {
 				log.Println("Retrying stream")
 				for {
-					time.Sleep(time.Second * 1)
+					time.Sleep(time.Second * 3)
 					err := s.assignStream()
 					if err == nil {
 						goto start
 					}
 				}
-			} else {
-				return nil, err
 			}
 		}
 	}