I am currently doing a script to retrieve data, I have a personal RPC that accepts 600 calls/second, but my script is making more than 600 calls/second using the getParsedTransactions() method via the web3.js library, so my question is: Is there a way to limit the number of calls/second?
1 Answer
Yes there is a way to do this by using the batchSize
parameter in the provider.send
function to reduce the number of requests made in a single batch, this will assist the number of request by second made.
const setProvider = new SolanaWeb3Provider('https://testnet.solana.com',{batchSize = 1});
const makeRequests = [
//Your Request
];
setProvider.send(makeRequests, (err, res) => {
if(err){
console.error(err);
return;
}
// Deal with any response
});
limit
a large result set