General purpose function to retry on database timeout

This commit is contained in:
CJ Cobb
2022-01-25 20:10:02 +00:00
parent da96608feb
commit bc131f666a
7 changed files with 117 additions and 136 deletions

View File

@@ -232,8 +232,11 @@ SubscriptionManager::pubTransaction(
auto amount = tx->getFieldAmount(ripple::sfTakerGets);
if (account != amount.issue().account)
{
auto ownerFunds =
RPC::accountFunds(*backend_, lgrInfo.seq, amount, account);
auto ownerFunds = Backend::retryOnTimeout([&]() {
return RPC::accountFunds(
*backend_, lgrInfo.seq, amount, account);
});
pubObj["transaction"].as_object()["owner_funds"] =
ownerFunds.getText();
}