Revert "Merge pull request #7732 from heyitsanthony/lease-err-ka"

This reverts commit fbbc4a4979, reversing
changes made to f254e38385.

Fixes #7851
This commit is contained in:
Anthony Romano
2017-05-02 09:34:54 -07:00
parent f0ca65a95d
commit 6dd8fb6f24
9 changed files with 144 additions and 137 deletions

View File

@ -56,6 +56,7 @@ func runLeaseRenewerFunc(cmd *cobra.Command, args []string) {
for {
var (
l *clientv3.LeaseGrantResponse
lk *clientv3.LeaseKeepAliveResponse
err error
)
for {
@ -67,14 +68,13 @@ func runLeaseRenewerFunc(cmd *cobra.Command, args []string) {
expire := time.Now().Add(time.Duration(l.TTL-1) * time.Second)
for {
lk := c.Lease.KeepAliveOnce(ctx, l.ID)
err = lk.Err
lk, err = c.Lease.KeepAliveOnce(ctx, l.ID)
if grpc.Code(err) == codes.NotFound {
if time.Since(expire) < 0 {
log.Fatalf("bad renew! exceeded: %v", time.Since(expire))
for {
lk = c.Lease.KeepAliveOnce(ctx, l.ID)
fmt.Println(lk)
lk, err = c.Lease.KeepAliveOnce(ctx, l.ID)
fmt.Println(lk, err)
time.Sleep(time.Second)
}
}