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
Parallel example does not work! #31
Comments
I'm trying to use this for async validations with an object of validations, like {email:.notNull().isEmail(), username: .len(5,20)}. using async.parallel, it runs all the validations, but not asynchronously. no matter how long the first function (wrapping a chain of validations on one attribute) takes, it will always finish before the next function begins. do we have to call nextTick ourselves? |
I guess .parallel does not delegate to .nextTick(). Using a setTimeout within the tasks, they do run asynchronously, but otherwise they block. Should we call process.nextTick() ourselves then within the individual tasks? `
` Returns: Starting ZERO
|
The docs have been updated explaining that this is the intended functionality. |
I tried the parallel example:
async.parallel([
function(callback){
setTimeout(function(){
callback(null, 'one');
}, 200);
},
function(callback){
setTimeout(function(){
callback(null, 'two');
}, 100);
},
],
// optional callback
function(err, results){
// in this case, the results array will equal ['two','one']
// because the functions were run in parallel and the second
// function had a shorter timeout before calling the callback.
});
But it returns ['one', 'two'] instead of ['two', 'one']
Any ideas why?
The text was updated successfully, but these errors were encountered: