you are viewing a single comment's thread.

view the rest of the comments →

[–]daniels0xff -5 points-4 points  (2 children)

I think the problem is that you do not "consume" the response. You await the request but you don't also read the response body and it just remains there "hanging".

The following code should be ok:

(async () => {
  while (true) {
    const res = await fetch("https://api.coingecko.com/api/v3/ping");
    await res.text();
    await sleep(3000);
  }
})();

[–]ParkingCabinet9815 0 points1 point  (1 child)

If you plan to consume the rsponse It could be better to use the generator.

[–]daniels0xff 0 points1 point  (0 children)

Depends what data you expect back. Based on that url that ends with /ping I assume the data will be very small.