-
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
auto allows functions to start after error is passed #988
Comments
I run into the same problem, here is a simpler test case, and it sets concurrencty to var assert = require('assert')
var async = require('async')
async.auto({
task1: function (callback) {
callback('error')
},
task2: function (callback) {
assert.fail('task2 should not be called')
}
}, 1, function (error) {
assert.equal(error, 'error', 'callback with "error"')
}) you can see it run here: https://tonicdev.com/gr2m/5683f3895728b70d0082625d |
I’ll look into this and send a PR today |
gr2m
added a commit
to gr2m/async
that referenced
this issue
Dec 30, 2015
gr2m
added a commit
to gr2m/async
that referenced
this issue
Dec 30, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After a task in an
async.auto
calls back with an error (in the following example, this is taskx
) it should stop the processing of future tasks. However, it still allows the taskc
to run.Example:
Output:
A quick explanation of what is happening (and what should be happening):
a
,b
, andx
immediately begin executing (since they have no dependencies).b
completes first andx
calls-back with an error. At this point the final callback properly executes followed byx
anda
. The following execution ofc
is the failure because the error fromx
is called-back beforea
(the dependency ofc
) can complete.That said, I can see a valid argument for this functionality: i.e. because
c
does not depend onx
it should be allowed to execute; however, because the callback runs immediately upon receiving an error, can only handle a single error, and does not include the results fromc
it seems that theauto
function should dump any remaining tasks.The text was updated successfully, but these errors were encountered: