Skip to content

Conversation

@jnordberg
Copy link
Contributor

Allowing you to implement things like error logging and task retries more easily, like so:

var q = async.queue(function(task, callback) {
    console.log('Oops.');
    callback(new Error('I fail every time'));
});

q.error = function(error, task) {
    if (task.retries == null) task.retries = 0;
    task.retries++;
    if (task.retries < 3) {
        q.push(task);
    } else {
        console.log('This isnt working...');
    }
};

q.push({foo: 'bar'});

jnordberg added 2 commits May 29, 2016 12:06
With the signature `function(error, task){}`
@aearly
Copy link
Collaborator

aearly commented May 31, 2016

Looks good. This feature has been requested a few times before.

Can you add a note to the doc block about the feature?

@jnordberg
Copy link
Contributor Author

Sure, to the README right?

@megawac
Copy link
Collaborator

megawac commented May 31, 2016

@jnordberg to the jsdoc above the function preferably. The readme docs are on their way out

@aearly aearly merged commit 4c78fc2 into caolan:master May 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants