-
Notifications
You must be signed in to change notification settings - Fork 1.2k
🐛 Priorityqueue: Don't block on Get when queue is shutdown #3243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -300,6 +300,26 @@ var _ = Describe("Controllerworkqueue", func() { | |
Expect(metrics.depth["test"]).To(Equal(map[int]int{0: 2})) | ||
}) | ||
|
||
// ref: https://github.com/kubernetes-sigs/controller-runtime/issues/3239 | ||
It("Get from priority queue might get stuck when the priority queue is shut down", func() { | ||
q, _ := newQueue() | ||
|
||
q.Add("baz") | ||
// shut down | ||
q.ShutDown() | ||
q.AddWithOpts(AddOpts{After: time.Second}, "foo") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like Add still adds the item to the shutdown queue. Is this the expected behavior? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @alvaroaleman What's your take on this one? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can't really keep anyone from calling There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah that's what I was thinking |
||
|
||
item, priority, isShutDown := q.GetWithPriority() | ||
Expect(item).To(Equal("")) | ||
Expect(priority).To(Equal(0)) | ||
Expect(isShutDown).To(BeTrue()) | ||
|
||
item1, priority1, isShutDown := q.GetWithPriority() | ||
Expect(item1).To(Equal("")) | ||
Expect(priority1).To(Equal(0)) | ||
Expect(isShutDown).To(BeTrue()) | ||
}) | ||
|
||
It("items are included in Len() and the queueDepth metric once they are ready", func() { | ||
q, metrics := newQueue() | ||
defer q.ShutDown() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alvaroaleman Shouldn't we do this at the beginning of the func?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#3250