1

I have

async.parallel(tasksGetContentFromGitHub, function(err, res) {
    // all request over, do something
}

the problem is that I might have a large number of tasks, and each of them is sending a request to GitHub.

Since I am a nice citizen, I don't want to send 1000+ queries at once at GitHub, therefore I would like to batch those requests 10 at the time, and then execute my inner code.

Is there an easy way to do that?

1

1 Answer 1

1

You can try async.parallelLimit:

async.parallelLimit(tasksGetContentFromGitHub, 10, function(err, res) {
    // all request over, do something
}

Hope that it can help!

Sign up to request clarification or add additional context in comments.

2 Comments

I went through the doc, but it seems like I had miss that one. Works like a charm. Thanks a lot guys!
Nice. It's great to know that! :D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.