fix account_tx iteration

This commit is contained in:
CJ Cobb
2021-07-15 20:12:20 +00:00
12 changed files with 673 additions and 1464 deletions

View File

@@ -55,14 +55,14 @@ BackendInterface::writeLedgerObject(
std::move(book));
}
std::optional<LedgerRange>
BackendInterface::fetchLedgerRangeNoThrow() const
BackendInterface::hardFetchLedgerRangeNoThrow() const
{
BOOST_LOG_TRIVIAL(warning) << __func__;
while (true)
{
try
{
return fetchLedgerRange();
return hardFetchLedgerRange();
}
catch (DatabaseTimeout& t)
{
@@ -205,6 +205,7 @@ BackendInterface::fetchLedgerPage(
uint32_t adjustedLimit = std::max(limitHint, std::max(limit, (uint32_t)4));
LedgerPage page;
page.cursor = cursor;
int numCalls = 0;
do
{
adjustedLimit = adjustedLimit >= 8192 ? 8192 : adjustedLimit * 2;
@@ -223,8 +224,7 @@ BackendInterface::fetchLedgerPage(
page.objects.insert(
page.objects.end(), partial.objects.begin(), partial.objects.end());
page.cursor = partial.cursor;
} while (page.objects.size() < limit && page.cursor);
} while (page.objects.size() < limit && page.cursor && ++numCalls < 10);
if (incomplete)
{
auto rng = fetchLedgerRange();
@@ -278,7 +278,7 @@ BackendInterface::fetchLedgerPage(
void
BackendInterface::checkFlagLedgers() const
{
auto rng = fetchLedgerRangeNoThrow();
auto rng = hardFetchLedgerRangeNoThrow();
if (rng)
{
bool prevComplete = true;