I'm working on a backend that has to request data from Moralis (web3), but how can I spread the requests in time so that I don't exceed the max requests each minute and so it doesn't time out. Right now I'm calling a function within a for loop.
const allContractInfo = await Moralis.Web3API.token.getAllTokenIds({ address: address, chain: "rinkeby", });
const nftItems = allContractInfo.result;
for(let i = 0; i < allContractInfo.total; i++){
UpdateItemAuction(nftItems[i].token_address, nftItems[i].token_id)
}
This is just an example to fix this problem. Hope you can find better solutions.
This will ensure that requests are fired 1/sec.