lease/lessor.go
func (le *lessor) findExpiredLeases(limit int) []*Lease {
	leases := make([]*Lease, 0, 16)

	for {
		l, ok, next := le.expireExists()
		if !ok && !next {
			break
		}
		if !ok {
			continue
		}
		if next {
			continue
		}

		if l.expired() {
			leases = append(leases, l)

			// reach expired limit
			if len(leases) == limit {
				break
			}
		}
	}

	return leases
}
func (le *lessor) findExpiredLeases(limit int) []*Lease {
	leases := make([]*Lease, 0, 16)

	for {
		l, ok, next := le.expireExists()
		if !ok && !next {
			break
		}
		if !ok {
			continue
		}
		if next {
			continue
		}

		if l.expired() {
			leases = append(leases, l)

			// reach expired limit
			if len(leases) == limit {
				break
			}
		}
	}

	return leases
}
func ( le * lessor ) findExpiredLeases ( limit int ) [ ] * Lease { leases := make ( [ ] * Lease , 0 , 16 ) for { l , ok , next := le . expireExists ( ) if ! ok && ! next { break } if ! ok { continue } if next { continue } if l . expired ( ) { leases = append ( leases , l ) // reach expired limit if len ( leases ) == limit { break } } } return leases }
// findExpiredLeases loops leases in the leaseMap until reaching expired limit
// and returns the expired leases that needed to be revoked.
findExpiredLeases loops leases in the leaseMap until reaching expired limit and returns the expired leases that needed to be revoked .