Skip to content

Commit e0be271

Browse files
committed
chore: reduce indexing error message size and explicit retry
1 parent e3ba5ff commit e0be271

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

BTCPayServer.Plugins.USDt/Services/TronUSDtListener.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
using Nethereum.Contracts;
2424
using Nethereum.Contracts.Standards.ERC20.ContractDefinition;
2525
using Nethereum.Hex.HexTypes;
26+
using Nethereum.JsonRpc.Client;
2627
using Nethereum.RPC.Eth.DTOs;
2728
using Nethereum.Web3;
2829

@@ -132,6 +133,16 @@ await web3Client.Eth.Blocks.GetBlockWithTransactionsByNumber.SendRequestAsync(
132133
await SetTrackingState(configurationItem, listenerState);
133134
}
134135
}
136+
catch(RpcClientTimeoutException e)
137+
{
138+
logger.LogWarning("Timeout while indexing, is the node running? Retrying in 10 seconds");
139+
Thread.Sleep(5_000);
140+
}
141+
catch(RpcClientUnknownException e) when (e.InnerException?.Message?.Contains("429 (Too Many Requests)") == true)
142+
{
143+
logger.LogWarning("Rate limit exceeded while indexing, use a Tron node with higher limits if possible. Retrying in 10 seconds");
144+
Thread.Sleep(10_000);
145+
}
135146
catch (Exception e)
136147
{
137148
logger.LogError(e, "An error occurred while indexing");

0 commit comments

Comments
 (0)