Skip to content

Instantly share code, notes, and snippets.

@akkunchoi
Created January 15, 2015 07:21
Show Gist options
  • Save akkunchoi/542dc9e8f66ab96ac06f to your computer and use it in GitHub Desktop.
Save akkunchoi/542dc9e8f66ab96ac06f to your computer and use it in GitHub Desktop.
async parallelLimit
var async = require('async');
var _ = require('lodash');
var proc = _.range(1, 10).map(function(i){
console.log('init', i);
return function(callback){
console.log('start', i);
setTimeout(function(){
console.log('end', i);
callback(null, i);
}, 1000 * i);
};
});
async.parallelLimit(proc, 2, function(){
console.log('done');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment