Stop mixing callbacks and async procs. Your `download` async proc finishes
before your download operation finishes because you are not awaiting the
`download` proc. Just do this:
await downloader.downloadFile(node.mediaLink(board, thread), downFileName)
Run
> Is this a wrong link? because that doesn't look synchronous.
Ops sorry I had changed the link.
> One important thing to know is that you should never use waitFor in an async
> procedure, use await.
If I use await, the main thread doesn't stop until all the coroutines I create
inside the
> To keep multiple connections open at a time you will need a separate
> HttpClient for each.
Ah that fixes it. Thanks a bunch.
> 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
To keep multiple connections open at a time you will need a separate HttpClient
for each. Try moving webClient = newAsyncHttpClient() into the for loop so each
call to webClient.downloadFile has it's own client
Hi, I'm still trying to figure out async/await. I am writing a script that
parses a json returned by a forum API and tries to download all the files
described by the json. Writing a synchronous downloader script was a breeze: