Skip to content

queue.remove() with filter function #1391

Closed
@robsch

Description

@robsch

I'm currently finding a way to remove certain unprocessed entries in a queue/priorityQueue. I don't know how to do it, so I would appreciate if anyone could give me a hint.

Feature suggestion: add another method with which entries gets removed like that:

var q = async.queue(function (task, callback) {
    callback();
});
q.push({some: 'thing'});
q.remove(function (task) {
    return task.some === 'thing'; // remove task if return value is true
});

Or with the priority queue:

var q = async.priorityQueue(function (task, callback) {
    callback();
}, 3);
q.push({some: 'thing'}, 100);
q.remove(function (task, priority) {
    return task.some === 'thing'; // remove task if return value is true
    or
    return priority === 100; // remove task with certain priority
});

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions