0

so far ive tried this but it turned out to be slower than the original one.

https://gist.github.com/SkyBlockDev/ff4b81f45ed284fe6a31b63926cc9de3

Couldn't find any other way of doing this while being able to keep the results.

i was originally doing this which was faster but i want to be able to do all requests (65+) at once for faster speeds since this takes like 15 seconds.

    for a in 2..r.total_pages {
        let r = get(a).await;
        auctions = parse_hypixel(r.auctions, auctions);
    }

tricked
  • 11
  • 1
  • 2
  • I would suggest `Future::join_all`, but looks like your linked version already does that (you should include it in your post). But `async move { async move { ... } }` is definitely wrong, this would need to be `.await`'d twice as evidenced by you having to `.await` the `body` as well, which means no work is really done until the last `for` loop, so it'll effectively run sequentially just like the original. – kmdreko Sep 19 '21 at 02:07
  • Ditch the extra `async move { .. }` and you'll avoid having `body.await`. If everything else is right in your code, then it should work and run the calls concurrently. – kmdreko Sep 19 '21 at 02:08
  • See the answer using `Future::join_all` here: [How can I perform parallel asynchronous HTTP GET requests with reqwest?](https://stackoverflow.com/questions/51044467/how-can-i-perform-parallel-asynchronous-http-get-requests-with-reqwest) – kmdreko Sep 19 '21 at 02:11

0 Answers0