Note that there are some explanatory texts on larger screens.

plurals
  1. POAsync.js Parallel Callback not executing
    primarykey
    data
    text
    <p>I'm working with the <a href="https://github.com/caolan/async#parallel" rel="nofollow noreferrer">parallel function in Async.js</a> and for some reason the final call back is not getting executed and I do not see an error happening anywhere. </p> <p>I'm dynamically creating an array of functions that are passed to the parallel call as such: </p> <pre><code>// 'theFiles' is an array of files I'm working with in a code-generator style type of scenario var callItems = []; theFiles.forEach(function(currentFile) { var genFileFunc = generateFileFunc(destDir + "/" + currentFile, packageName, appName); callItems.push(genFileFunc(function(err, results) { if(err) { console.error("*** ERROR ***" + err); } else { console.log("Done: " + results); } })); }); async.parallel(callItems, function(err, results) { console.log(err); console.log(results); if(err) { console.error("**** ERROR ****"); } else { console.log("***** ALL ITEMS HAVE BEEN CALLED WITHOUT ERROR ****"); } }); </code></pre> <p>Then in an outside function (outside of the function that is executing the forEach above) I have the generateFileFunc() function. </p> <pre><code>// Function that returns a function that works with a file (modifies it/etc). function generateFileFunc(file, packageName, appName) { return function(callback) { generateFile(file, packageName, appName, callback); } } </code></pre> <p>I've looked at <a href="https://stackoverflow.com/questions/6496979/passing-arrays-of-functions-to-async-parallel">this SO post</a> and it helped me get to where I'm at. However the final call back is not being executed. All of the items in the parallel call are being executed though. Inside of gnerateFile (function) at the very bottom I call the callback, so thats golden. </p> <p>Anyone have any idea why this might not be executing properly? </p> <p>The end result is to work with each function call in parallel and then be notified when I'm done so I can continue executing some other instructions. </p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload