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

auto allows functions to start after error is passed #57

Closed
e174596549 opened this issue Apr 10, 2018 · 5 comments
Closed

auto allows functions to start after error is passed #57

e174596549 opened this issue Apr 10, 2018 · 5 comments
Labels

Comments

@e174596549
Copy link

e174596549 commented Apr 10, 2018

This issue #988 was fixed in async v1.5.1 but still exist in neo-async.

Throw an exception when async.auto calls back with an error Error: async.auto task has cyclic dependencies.

@suguru03
Copy link
Owner

Thanks for the issue!

I have the test case and can't reproduce it.
Which version are you using? Also, do you have any code to reproduce it?

it('should stop execution if a synchronous error occur', function(done) {
async.auto({
task1: function(callback) {
callback('error');
},
task2: function(callback) {
assert.ok(false);
callback();
}
}, 1, function(err) {
assert.strictEqual(err, 'error');
setTimeout(done, delay);
});
});

@e174596549
Copy link
Author

neo-async v2.5

const async = require('neo-async');

async.auto({
    task1: function(callback) {
        setTimeout(()=>{callback('error')}, 1000)
    },
    task2: function(callback) {
        setTimeout(()=>{callback(false)}, 2000)
    },
    task3: ['task1', 'task2', function(callback) {
        setTimeout(()=>{callback(false)}, 2000)
    }]
}, function(err) {
    if(err) {
        return console.log('err: ', err)
    }
    console.log('done')
});

/usr/local/bin/node /Users/neo-async-test.js
err:  error
/Users/node_modules/.2.5.0@neo-async/async.js:8167
          throw new Error('async.auto task has cyclic dependencies');
          ^

Error: async.auto task has cyclic dependencies
    at proceedQueue (/Users/node_modules/.2.5.0@neo-async/async.js:8167:17)
    at taskComplete (/Users/node_modules/.2.5.0@neo-async/async.js:8187:7)
    at done (/Users/node_modules/.2.5.0@neo-async/async.js:8153:9)
    at Timeout.setTimeout [as _onTimeout] (/Users/neo-async-test.js:8:25)
    at ontimeout (timers.js:475:11)
    at tryOnTimeout (timers.js:310:5)
    at Timer.listOnTimeout (timers.js:270:5)

async v2.1.4

const async = require('async');

async.auto({
    task1: function(callback) {
        setTimeout(()=>{callback('error')}, 1000)
    },
    task2: function(callback) {
        setTimeout(()=>{callback(false)}, 2000)
    },
    task3: ['task1', 'task2', function(callback) {
        setTimeout(()=>{callback(false)}, 2000)
    }]
}, function(err) {
    if(err) {
        return console.log('err: ', err)
    }
    console.log('done')
});


err:  error

Process finished with exit code 0

@suguru03
Copy link
Owner

@e174596549
I can reproduce it!
I'll fix it soon, thanks! 😄

@suguru03
Copy link
Owner

I published it on v2.5.1, could you check it? Thanks! 😸

@e174596549
Copy link
Author

This version can be executed correctly. Thanks! 👍🏻

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

No branches or pull requests

2 participants