-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
update priorityQueue functionality to match queue [fixes #1725] #1790
Conversation
The failed tests don't seem to be related to this PR, tests for other functions are timing out. |
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.
Thanks for this, this has been a missing feature for a while. Just a small question.
@@ -31,26 +31,25 @@ describe('priorityQueue', () => { | |||
expect(q.length()).to.equal(0); | |||
call_order.push('callback ' + 3); | |||
}); | |||
q.push(4, 2.9, (err, arg) => { |
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.
The expected lengths change, due to pushing this array, correct?
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.
Yes sir, we don't test pushing an array in any of the other priorityQueue
tests, so I thought it would be useful to add.
@aearly is this good to go? |
I'm running into an issue with the build, looks like somewhere along the way one of |
@aearly published |
This PR updates the
priorityQueue
behaviour to match thequeue
implementation:priorityQueue
(see PriorityQueue push doesn't wait for result #1725).pushAsync
and removesunshiftAsync
.drain
wasn't being called when an empty task was pushed.queue
logic inqueue
. The one issue with this is it now iterates over thetasks
twice, once inpriorityQueue
and once inqueue
. Let me know if there's a better way you can think of.I also added a few tests from
queue
topriorityQueue
to make sure the functionality matches.