mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-06 17:27:58 +00:00
make keysRepair async
This commit is contained in:
@@ -74,6 +74,15 @@ BackendIndexer::doKeysRepair(
|
||||
BOOST_LOG_TRIVIAL(info)
|
||||
<< __func__ << " finished. sequence = " << std::to_string(*sequence);
|
||||
}
|
||||
void
|
||||
BackendIndexer::doKeysRepairAsync(
|
||||
BackendInterface const& backend,
|
||||
std::optional<uint32_t> sequence)
|
||||
{
|
||||
boost::asio::post(ioc_, [this, sequence, &backend]() {
|
||||
doKeysRepair(backend, sequence);
|
||||
});
|
||||
}
|
||||
|
||||
void
|
||||
BackendIndexer::writeKeyFlagLedgerAsync(
|
||||
|
||||
@@ -88,6 +88,10 @@ class BackendIndexer
|
||||
std::unordered_set<ripple::uint256> keys;
|
||||
|
||||
mutable bool isFirst_ = true;
|
||||
void
|
||||
doKeysRepair(
|
||||
BackendInterface const& backend,
|
||||
std::optional<uint32_t> sequence);
|
||||
|
||||
public:
|
||||
BackendIndexer(boost::json::object const& config);
|
||||
@@ -103,7 +107,7 @@ public:
|
||||
uint32_t ledgerSequence,
|
||||
BackendInterface const& backend);
|
||||
void
|
||||
doKeysRepair(
|
||||
doKeysRepairAsync(
|
||||
BackendInterface const& backend,
|
||||
std::optional<uint32_t> sequence);
|
||||
uint32_t
|
||||
@@ -171,7 +175,7 @@ public:
|
||||
auto rng = fetchLedgerRangeNoThrow();
|
||||
if (rng && rng->minSequence != ledgerSequence)
|
||||
isFirst_ = false;
|
||||
indexer_.doKeysRepair(*this, ledgerSequence);
|
||||
indexer_.doKeysRepairAsync(*this, ledgerSequence);
|
||||
}
|
||||
if (indexer_.isKeyFlagLedger(ledgerSequence) || isFirst_)
|
||||
indexer_.writeKeyFlagLedgerAsync(ledgerSequence, *this);
|
||||
|
||||
Reference in New Issue
Block a user