> Writing a synchronous downloader script was a breeze: 
> [https://gitlab.com/snippets/1967018](https://gitlab.com/snippets/1967018)

Is this a wrong link? because that doesn't look synchronous.

You're doing a number of things incorrectly here. One important thing to know 
is that you should never use waitFor in an async procedure, use await.

What I believe is the problem though, is that you are reusing the same 
AsyncHttpClient instance for multiple concurrent requests. You need to create 
one AsyncHttpClient instance for each request that you want to be running 
concurrently. I'm going to create an issue on GitHub to show a better error 
message for this case.

The easiest way to make this work would probably be to split up 
parseJson(j)["posts"] into x many lists, then run x async procs on each list 
which create their own AsyncHttpClient and iterate through the list downloading 
each one-by-one (using await instead of storing each future and awaiting them 
all).

Reply via email to