File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
staging/src/k8s.io/client-go/util/workqueue Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -178,6 +178,9 @@ func (q *delayingType) waitingLoop() {
178
178
// Make a placeholder channel to use when there are no items in our list
179
179
never := make (<- chan time.Time )
180
180
181
+ // Make a timer that expires when the item at the head of the waiting queue is ready
182
+ var nextReadyAtTimer clock.Timer
183
+
181
184
waitingForQueue := & waitForPriorityQueue {}
182
185
heap .Init (waitingForQueue )
183
186
@@ -205,8 +208,12 @@ func (q *delayingType) waitingLoop() {
205
208
// Set up a wait for the first item's readyAt (if one exists)
206
209
nextReadyAt := never
207
210
if waitingForQueue .Len () > 0 {
211
+ if nextReadyAtTimer != nil {
212
+ nextReadyAtTimer .Stop ()
213
+ }
208
214
entry := waitingForQueue .Peek ().(* waitFor )
209
- nextReadyAt = q .clock .After (entry .readyAt .Sub (now ))
215
+ nextReadyAtTimer = q .clock .NewTimer (entry .readyAt .Sub (now ))
216
+ nextReadyAt = nextReadyAtTimer .C ()
210
217
}
211
218
212
219
select {
You can’t perform that action at this time.
0 commit comments