Skip to content

Commit

Permalink
lease: fix memory leak in LeaseGrant when node is follower
Browse files Browse the repository at this point in the history
  • Loading branch information
tangcong committed Mar 29, 2020
1 parent 3ac7a11 commit 855d492
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lease/lessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,14 @@ func (le *lessor) Grant(id LeaseID, ttl int64) (*Lease, error) {
}

le.leaseMap[id] = l
item := &LeaseWithTime{id: l.ID, time: l.expiry.UnixNano()}
le.leaseExpiredNotifier.RegisterOrUpdate(item)
l.persistTo(le.b)

leaseTotalTTLs.Observe(float64(l.ttl))
leaseGranted.Inc()

if le.isPrimary() {
item := &LeaseWithTime{id: l.ID, time: l.expiry.UnixNano()}
le.leaseExpiredNotifier.RegisterOrUpdate(item)
le.scheduleCheckpointIfNeeded(l)
}

Expand Down

0 comments on commit 855d492

Please sign in to comment.