I am working on a project which requires me to make api calls every minute and then process the data.
Currently I am using SetInterval Method in Javascript along with a fetch call .
But I am wondering if this is the best way to do this process. Or what are the drawbacks of using setInterval to make api calls repeatedly and show the processed data on the client.
SAMPLE CODE
const timeInterval = 10000;
setInterval(() => {
fetch("https://api.solscan.io/nft/market/trade?offset=0&limit=10")
.then((response) => response.json())
.then((result) => processTradingData(result));
}, timeInterval);
Please Feel free to suggest better ways to do this, Current approaches drawback. I have plans to make this into a full-fldged product [So please let me know if the current Implementation is a good one or needs improvement].
Thank You.