func (q *RateLimitedTimedQueue) Try(fn ActionFunc) {
	val, ok := q.queue.Head()
	q.limiterLock.Lock()
	defer q.limiterLock.Unlock()
	for ok {
		// rate limit the queue checking
		if !q.limiter.TryAccept() {
			klog.V(10).Infof("Try rate limited for value: %v", val)
			// Try again later
			break
		}

		now := now()
		if now.Before(val.ProcessAt) {
			break
		}

		if ok, wait := fn(val); !ok {
			val.ProcessAt = now.Add(wait + 1)
			q.queue.Replace(val)
		} else {
			q.queue.RemoveFromQueue(val.Value)
		}
		val, ok = q.queue.Head()
	}
}
// Try processes the queue.Ends prematurely if RateLimiter forbids an
// action and leak is true. Otherwise, requeues the item to be
// processed. Each value is processed once if fn returns true,
// otherwise it is added back to the queue. The returned remaining is
// used to identify the minimum time to execute the next item in the
// queue. The same value is processed only once unless Remove is
// explicitly called on it (it's done by the cancelPodEviction
// function in NodeController when Node becomes Ready again) TODO:
// figure out a good way to do garbage collection for all Nodes that
// were removed from the cluster.
Try processes the queue.Ends prematurely if RateLimiter forbids an
action and leak is true. Otherwise, requeues the item to be
processed. Each value is processed once if fn returns true,
otherwise it is added back to the queue. The returned remaining is
used to identify the minimum time to execute the next item in the
queue. The same value is processed only once unless Remove is
explicitly called on it (it's done by the cancelPodEviction
function in NodeController when Node becomes Ready again) TODO:
figure out a good way to do garbage collection for all Nodes that
were removed from the cluster.
// Try processes the queue . Ends prematurely if RateLimiter forbids an // action and leak is true . Otherwise requeues the item to be // processed . Each value is processed once if fn returns true // otherwise it is added back to the queue . The returned remaining is // used to identify the minimum time to execute the next item in the // queue . The same value is processed only once unless Remove is // explicitly called on it ( it ' s done by the cancelPodEviction // function in NodeController when Node becomes Ready again ) TODO : // figure out a good way to do garbage collection for all Nodes that // were removed from the cluster .
func (q *RateLimitedTimedQueue) Try(fn ActionFunc) {
	val, ok := q.queue.Head()
	q.limiterLock.Lock()
	defer q.limiterLock.Unlock()
	for ok {
		if !q.limiter.TryAccept() {
			klog.V(10).Infof("Try rate limited for value: %v", val)
			break
		}
		now := now()
		if now.Before(val.ProcessAt) {
			break
		}
		if ok, wait := fn(val); !ok {
			val.ProcessAt = now.Add(wait + 1)
			q.queue.Replace(val)
		} else {
			q.queue.RemoveFromQueue(val.Value)
		}
		val, ok = q.queue.Head()
	}
}
func ( q * RateLimitedTimedQueue ) Try ( fn ActionFunc ) { val , ok := q . queue . Head ( ) q . limiterLock . Lock ( ) defer q . limiterLock . Unlock ( ) for ok { if ! q . limiter . TryAccept ( ) { klog . V ( 10 ) . Infof ( " " , val ) break } now := now ( ) if now . Before ( val . ProcessAt ) { break } if ok , wait := fn ( val ) ; ! ok { val . ProcessAt = now . Add ( wait + 1 ) q . queue . Replace ( val ) } else { q . queue . RemoveFromQueue ( val . Value ) } val , ok = q . queue . Head ( ) } }
Try processes the queue.Ends prematurely if RateLimiter forbids an
action and leak is true.
Try processes the queue . Ends prematurely if RateLimiter forbids an action and leak is true .
// rate limit the queue checking // Try again later