You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The lease mechanism of etcd does not perform a pop operation directly when detecting an expired lease. Instead, it extends the expiration time of the lease and reorganizes the heap, and only pops the expired lease from the heap during the next round of detection。What is the reason for doing this?
func (le*lessor) expireExists() (l*Lease, nextbool) {
ifle.leaseExpiredNotifier.Len() ==0 {
returnnil, false
}
item:=le.leaseExpiredNotifier.Peek()
l=le.leaseMap[item.id]
ifl==nil {
// lease has expired or been revoked// no need to revoke (nothing is expiry)le.leaseExpiredNotifier.Unregister() // O(log N)returnnil, true
}
now:=time.Now()
ifnow.Before(item.time) /* item.time: expiration time */ {
// Candidate expirations are caught up, reinsert this item// and no need to revoke (nothing is expiry)returnnil, false
}
// recheck if revoke is complete after retry intervalitem.time=now.Add(le.expiredLeaseRetryInterval)
le.leaseExpiredNotifier.RegisterOrUpdate(item)
returnl, false
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The lease mechanism of etcd does not perform a pop operation directly when detecting an expired lease. Instead, it extends the expiration time of the lease and reorganizes the heap, and only pops the expired lease from the heap during the next round of detection。What is the reason for doing this?
Beta Was this translation helpful? Give feedback.
All reactions