*: deprecate grpc.Code, grpc.ErrorDesc

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
This commit is contained in:
Gyu-Ho Lee
2017-09-08 11:50:57 -07:00
parent 18ba4d60ec
commit 6f76d52a1a
10 changed files with 35 additions and 21 deletions

View File

@@ -24,8 +24,8 @@ import (
"github.com/coreos/etcd/clientv3"
"github.com/spf13/cobra"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
var (
@@ -68,7 +68,8 @@ func runLeaseRenewerFunc(cmd *cobra.Command, args []string) {
for {
lk, err = c.Lease.KeepAliveOnce(ctx, l.ID)
if grpc.Code(err) == codes.NotFound {
ev, _ := status.FromError(err)
if ev.Code() == codes.NotFound {
if time.Since(expire) < 0 {
log.Fatalf("bad renew! exceeded: %v", time.Since(expire))
for {

View File

@@ -106,7 +106,7 @@ func (s *keyStresser) run(ctx context.Context) {
continue
}
switch grpc.ErrorDesc(err) {
switch rpctypes.ErrorDesc(err) {
case context.DeadlineExceeded.Error():
// This retries when request is triggered at the same time as
// leader failure. When we terminate the leader, the request to