etcdserver: fix "lease_expired_total" metrics

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
Gyuho Lee 2018-04-10 13:57:17 -07:00
parent e095ee48f4
commit 744c73e019

View File

@ -821,10 +821,13 @@ func (s *EtcdServer) run() {
lid := lease.ID
s.goAttach(func() {
ctx := s.authStore.WithRoot(s.ctx)
if _, lerr := s.LeaseRevoke(ctx, &pb.LeaseRevokeRequest{ID: int64(lid)}); lerr != nil {
_, lerr := s.LeaseRevoke(ctx, &pb.LeaseRevokeRequest{ID: int64(lid)})
if lerr == nil {
leaseExpired.Inc()
} else {
plog.Warningf("failed to revoke %016x (%q)", lid, lerr.Error())
}
leaseExpired.Inc()
<-c
})
}