Skip to content

Commit

Permalink
v3rpc: LeaseTimeToLive returns TTL=-1 resp on lease not found
Browse files Browse the repository at this point in the history
  • Loading branch information
fanminshi committed Feb 11, 2017
1 parent 9b72c8b commit 2ca1823
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion etcdserver/api/v3rpc/lease.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,16 @@ func (ls *LeaseServer) LeaseRevoke(ctx context.Context, rr *pb.LeaseRevokeReques

func (ls *LeaseServer) LeaseTimeToLive(ctx context.Context, rr *pb.LeaseTimeToLiveRequest) (*pb.LeaseTimeToLiveResponse, error) {
resp, err := ls.le.LeaseTimeToLive(ctx, rr)
if err != nil {
if err != nil && err != lease.ErrLeaseNotFound {
return nil, togRPCError(err)
}
if err == lease.ErrLeaseNotFound {
resp = &pb.LeaseTimeToLiveResponse{
Header: &pb.ResponseHeader{},
ID: rr.ID,
TTL: -1,
}
}
ls.hdr.fill(resp.Header)
return resp, nil
}
Expand Down

0 comments on commit 2ca1823

Please sign in to comment.