Skip to content

Commit

Permalink
etcd-runner: update to use new lease interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony Romano committed Apr 21, 2017
1 parent 652ad3d commit ab89ffd
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ func runLeaseRenewerFunc(cmd *cobra.Command, args []string) {
for {
var (
l *clientv3.LeaseGrantResponse
lk *clientv3.LeaseKeepAliveResponse
err error
)
for {
Expand All @@ -62,13 +61,14 @@ func runLeaseRenewerFunc(cmd *cobra.Command, args []string) {
expire := time.Now().Add(time.Duration(l.TTL-1) * time.Second)

for {
lk, err = c.Lease.KeepAliveOnce(ctx, l.ID)
lk := c.Lease.KeepAliveOnce(ctx, l.ID)
err = lk.Err
if grpc.Code(err) == codes.NotFound {
if time.Since(expire) < 0 {
log.Printf("bad renew! exceeded: %v", time.Since(expire))
for {
lk, err = c.Lease.KeepAliveOnce(ctx, l.ID)
fmt.Println(lk, err)
lk = c.Lease.KeepAliveOnce(ctx, l.ID)
fmt.Println(lk)
time.Sleep(time.Second)
}
}
Expand Down

0 comments on commit ab89ffd

Please sign in to comment.