Created
April 5, 2020 10:56
-
-
Save Janoyan/f5101468c45d2d55c4f1cca8e9bc9801 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const bluebird = require('bluebird'); | |
async function task(data, ms = 500) { | |
console.log(data); | |
await bluebird.delay(ms); | |
return data; | |
} | |
bluebird.map(['A', 'B', 'C', 'D', 'E', 'F'], async (item) => { | |
return task(item); | |
}, { concurrency: 3 }).then((result) => { | |
console.log(result); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment