-
Notifications
You must be signed in to change notification settings - Fork 1.2k
⚠️ Priorityqueue: Make priority opt a pointer #3289
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
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alvaroaleman The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Making the priority opt a pointer allows to dinstinguish "unset" from "0". While this is irrelevant for the priorityqueue itself, it is required for any wrapper that wants to inject a default priority without overriding one that was explicitly set.
@@ -136,7 +136,7 @@ func (h TypedFuncs[object, request]) Create(ctx context.Context, e event.TypedCr | |||
priority = LowPriority | |||
} | |||
q.(priorityqueue.PriorityQueue[request]).AddWithOpts( | |||
priorityqueue.AddOpts{Priority: priority}, | |||
priorityqueue.AddOpts{Priority: &priority}, |
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.
Should this only be set if IsInInitialList is true?
(currently we otherwise set it to &0)
(same below)
@@ -888,7 +888,10 @@ var _ = Describe("Eventhandler", func() { | |||
IsInInitialList: false, | |||
}, wq) | |||
|
|||
Expect(actualOpts).To(Equal(priorityqueue.AddOpts{})) | |||
Expect(actualOpts).To(Or( | |||
Equal(priorityqueue.AddOpts{}), |
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.
Wondering if &0 is correct here
(similar below)
I think my findings are addressed in #3290 /lgtm |
LGTM label has been added. Git tree hash: ab67793043706cbe1cb2c8b235fb7f9bdc2b6d3d
|
Making the priority opt a pointer allows to dinstinguish "unset" from "0". While this is irrelevant for the priorityqueue itself, it is required for any wrapper that wants to inject a default priority without overriding one that was explicitly set.