mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #14198 from SimFG/heap_top
lease: Rename `Poll` to `Peek` in the `LeaseExpiredNotifier`
This commit is contained in:
commit
186c895da8
@ -96,7 +96,7 @@ func (mq *LeaseExpiredNotifier) Unregister() *LeaseWithTime {
|
||||
return item
|
||||
}
|
||||
|
||||
func (mq *LeaseExpiredNotifier) Poll() *LeaseWithTime {
|
||||
func (mq *LeaseExpiredNotifier) Peek() *LeaseWithTime {
|
||||
if mq.Len() == 0 {
|
||||
return nil
|
||||
}
|
||||
|
@ -40,8 +40,8 @@ func TestLeaseQueue(t *testing.T) {
|
||||
}
|
||||
|
||||
// first element is expired.
|
||||
if le.leaseExpiredNotifier.Poll().id != LeaseID(1) {
|
||||
t.Fatalf("first item expected lease ID %d, got %d", LeaseID(1), le.leaseExpiredNotifier.Poll().id)
|
||||
if le.leaseExpiredNotifier.Peek().id != LeaseID(1) {
|
||||
t.Fatalf("first item expected lease ID %d, got %d", LeaseID(1), le.leaseExpiredNotifier.Peek().id)
|
||||
}
|
||||
|
||||
existExpiredEvent := func() {
|
||||
@ -60,8 +60,8 @@ func TestLeaseQueue(t *testing.T) {
|
||||
t.Fatalf("expected the expired lease to be pushed back to the heap, heap size got %d", le.leaseExpiredNotifier.Len())
|
||||
}
|
||||
|
||||
if le.leaseExpiredNotifier.Poll().id != LeaseID(1) {
|
||||
t.Fatalf("first item expected lease ID %d, got %d", LeaseID(1), le.leaseExpiredNotifier.Poll().id)
|
||||
if le.leaseExpiredNotifier.Peek().id != LeaseID(1) {
|
||||
t.Fatalf("first item expected lease ID %d, got %d", LeaseID(1), le.leaseExpiredNotifier.Peek().id)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -683,7 +683,7 @@ func (le *lessor) expireExists() (l *Lease, ok bool, next bool) {
|
||||
return nil, false, false
|
||||
}
|
||||
|
||||
item := le.leaseExpiredNotifier.Poll()
|
||||
item := le.leaseExpiredNotifier.Peek()
|
||||
l = le.leaseMap[item.id]
|
||||
if l == nil {
|
||||
// lease has expired or been revoked
|
||||
|
Loading…
x
Reference in New Issue
Block a user