I just call under 100 request/ min but still have error and the response is really slow
Is there any developers in here to help me ???
for (const tokenInfo of listTokenInfo) {
let listHolderAddress = getListHolderByXlsx(tokenInfo.symbol)
if (tokenInfo.symbol !== ‘PRL’) {
for (let i = 0; i < listHolderAddress.length; i++) {
try {
console.log(‘Init new private wallet info - %s - %s’, i, tokenInfo.symbol);
let listPrivateWallet = tokenInfo.private_address.split(’,’);
let walletAddress = listHolderAddress[i];
let transactionInfo = await axios.get(‘https://deep-index.moralis.io/api/v2/’ + ${walletAddress}/erc20/transfers?chain=bsc
,
{
headers: {
“X-API-Key”: config.MORALIS_KEY,
}
})
const listTransactionPrivate = transactionInfo.data.result.filter(e => {
return listPrivateWallet.includes(e.from_address) && e.address == tokenInfo.token_address.toLowerCase()
});
if (listTransactionPrivate.length > 0) {
await timer(2000);
totalAmount = listTransactionPrivate.map(item => parseInt(item.value)).reduce((prev, curr) => prev + curr, 0);
let balanceInfo = await axios.get(‘https://deep-index.moralis.io/api/v2/’ + ${walletAddress}/erc20?chain=bsc&token_addresses=${tokenInfo.token_address}
,
{
headers: {
“X-API-Key”: config.MORALIS_KEY,
}
})
let currentAmount = balanceInfo.data.length > 0 ? balanceInfo.data[0].balance : 0;
listHolderPrivate.push({
HolderAddress: walletAddress,
TokenAddress: tokenInfo.token_address,
PrivateAmount: totalAmount,
TotalAmount: parseInt(currentAmount)
})
await repo.insertRadaHolder({
HolderAddress: walletAddress,
TokenAddress: tokenInfo.token_address,
PrivateAmount: totalAmount,
TotalAmount: parseInt(currentAmount)
})
}
} catch (err) {
console.log(err);
}
}
repo.insertMultiRadaHolder(listHolderPrivate)
}
}
const timer = ms => new Promise(res => setTimeout(res, ms))
Still confuse Could you help me ?
when you go to https://admin.moralis.io/web3Api
you should find a new API key that you can try to use to see if it works now
i have tried new api key also and didnt work. I just have 60 -120 request/ minute but still error
what kind of requests are you making, do you have any specific error message? for 503 error, it can happen sometimes and all you have to do is to retry same request
You can see my code 2 execute 2 kind of requests. I dont know why some request they return 503. And after 250 request. The response time is really slow
I am not able to easily understand that code? what does it do? does it use pagination?
i am looping 500 times to get 500 wallet address information. I also set 1 second delay time for each request. But i dont know why it’s errors. Moralis didn’t support multi address 1 time. Just one by one
503 error could happen from time to time, that should not be caused by your code (and when it happens you should retry same request again), I don’t know about 500 error
you can see here how to format code on forum: READ BEFORE POSTING - How to post code in the forum
can you log every request that you make to see how many requests you make and if you really make them with delay?
I dont know but some request have 503 error. Retry is not good solution. But i didn’t request many time but. some is still 503. It’s not clear.
did you try again multiple times?
did you try with retry in case of 503 errors and it didn’t work?
How about if it will fail again. I use javascript to try catch but just 1 times. If it fail again how can i process.I want to all request 100% successfully at least give me a reason to fail
We have 503 sometimes on BSC because of the load and until we scale our systems it may happen
You can retry the request if it happens
It’s not your fault so there is no reason we can give you
If you need 100% successful calls - come back in a few months when we solved the BSC scaling project we have now
EDIT - we may actually have a solution for this BSC issue already this week