Skip to content

Commit

Permalink
grpcproxy: use new lease interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony Romano committed Apr 24, 2017
1 parent dc5b8f5 commit 84538e2
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions proxy/grpcproxy/lease.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,7 @@ func (lps *leaseProxyStream) recvLoop() error {
func (lps *leaseProxyStream) keepAliveLoop(leaseID int64, neededResps *atomicCounter) error {
cctx, ccancel := context.WithCancel(lps.ctx)
defer ccancel()
respc, err := lps.lessor.KeepAlive(cctx, clientv3.LeaseID(leaseID))
if err != nil {
return err
}
respc := lps.lessor.KeepAlive(cctx, clientv3.LeaseID(leaseID))
// ticker expires when loop hasn't received keepalive within TTL
var ticker <-chan time.Time
for {
Expand All @@ -276,7 +273,7 @@ func (lps *leaseProxyStream) keepAliveLoop(leaseID int64, neededResps *atomicCou
lps.mu.Unlock()
return nil
case rp, ok := <-respc:
if !ok {
if !ok || rp.Err != nil {
lps.mu.Lock()
delete(lps.keepAliveLeases, leaseID)
lps.mu.Unlock()
Expand Down

0 comments on commit 84538e2

Please sign in to comment.