[fold] fix infinite loop

This commit is contained in:
Denis Angell
2024-11-14 19:29:46 +01:00
parent 3e57c72dc5
commit 317549ec54
2 changed files with 26 additions and 25 deletions

View File

@@ -644,32 +644,32 @@ SHAMapStoreImp::clearPrior(LedgerIndex lastRotated)
if (!db)
Throw<std::runtime_error>("Failed to get relational database");
if (!app_.config().useTxTables())
return;
if (app_.config().useTxTables())
{
clearSql(
lastRotated,
"Transactions",
[&db]() -> std::optional<LedgerIndex> {
return db->getTransactionsMinLedgerSeq();
},
[&db](LedgerIndex min) -> void {
db->deleteTransactionsBeforeLedgerSeq(min);
});
if (healthWait() == stopping)
return;
clearSql(
lastRotated,
"Transactions",
[&db]() -> std::optional<LedgerIndex> {
return db->getTransactionsMinLedgerSeq();
},
[&db](LedgerIndex min) -> void {
db->deleteTransactionsBeforeLedgerSeq(min);
});
if (healthWait() == stopping)
return;
clearSql(
lastRotated,
"AccountTransactions",
[&db]() -> std::optional<LedgerIndex> {
return db->getAccountTransactionsMinLedgerSeq();
},
[&db](LedgerIndex min) -> void {
db->deleteAccountTransactionsBeforeLedgerSeq(min);
});
if (healthWait() == stopping)
return;
clearSql(
lastRotated,
"AccountTransactions",
[&db]() -> std::optional<LedgerIndex> {
return db->getAccountTransactionsMinLedgerSeq();
},
[&db](LedgerIndex min) -> void {
db->deleteAccountTransactionsBeforeLedgerSeq(min);
});
if (healthWait() == stopping)
return;
}
clearSql(
lastRotated,

View File

@@ -144,6 +144,7 @@ public:
transactionMap_.erase(txHash);
}
it->second.transactions.clear();
++it;
}
}