Search code examples
javascriptasynchronouspriority-queue

aysnc priorityQueue - is a higher number higher priority?


In the caolan/async library, what defines order for priority in priorityQueue? Is 1 first (highest) priority, or is a larger numeric value a higher priority?

The docs simply say the priority should be a number:

push(task, priority, [callback]) - priority should be a number. If an array of tasks is given, all tasks will be assigned the same priority.


Solution

  • From the document you referenced:

    The same as async.queue only tasks are assigned a priority and completed in ascending priority order.

    (emphasis added)

    That means that lower numbers will come first.