Skip to content
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

PriorityQueue push doesn't wait for result #1725

Closed
perusopersonale opened this issue Oct 1, 2020 · 2 comments
Closed

PriorityQueue push doesn't wait for result #1725

perusopersonale opened this issue Oct 1, 2020 · 2 comments
Assignees

Comments

@perusopersonale
Copy link

perusopersonale commented Oct 1, 2020

What version of async are you using?
^3.2.0
Which environment did the issue occur in (Node version/browser version)
Node: >=12
npm: 6.13.4

What did you do? Please include a minimal reproducable case illustrating issue.
Maybe I'm missing something but I thought that priorityQueue and queue have same behaviour
but if I run the following code, the output is 1

 const queue = async.queue( async (task) =>{
   return Promise.resolve(1)
 })          
const res = await queue.push({})
console.log(res)

instead if I run the following code the output is undefined

const queue = async.priorityQueue( async (task) =>{
  return Promise.resolve(1)
})
const res = await queue.push({},1)
console.log(res)
@darksabrefr
Copy link

darksabrefr commented Oct 28, 2021

A little late, but that's true. priorityQueue doesn't furnish all the promise style features shipped with v3.0.0. The push method cannot handle promise style, even if the worker can be an async function.
Moreover, The pushAsync method from v3.1.0 is not implemented at all (technically it is, but the priorityQueue code doesn't overload it to fit with the attended method signature that add a priority parameter)
In short: for the moment, only the callback style of priorityQueue is supported, not the promise one.

@hargasinski
Copy link
Collaborator

hargasinski commented May 1, 2022

Fixed in #1790.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants