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)
|
BOOST_LOG_TRIVIAL(info)
|
||||||
<< __func__ << " finished. sequence = " << std::to_string(*sequence);
|
<< __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
|
void
|
||||||
BackendIndexer::writeKeyFlagLedgerAsync(
|
BackendIndexer::writeKeyFlagLedgerAsync(
|
||||||
|
|||||||
@@ -88,6 +88,10 @@ class BackendIndexer
|
|||||||
std::unordered_set<ripple::uint256> keys;
|
std::unordered_set<ripple::uint256> keys;
|
||||||
|
|
||||||
mutable bool isFirst_ = true;
|
mutable bool isFirst_ = true;
|
||||||
|
void
|
||||||
|
doKeysRepair(
|
||||||
|
BackendInterface const& backend,
|
||||||
|
std::optional<uint32_t> sequence);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BackendIndexer(boost::json::object const& config);
|
BackendIndexer(boost::json::object const& config);
|
||||||
@@ -103,7 +107,7 @@ public:
|
|||||||
uint32_t ledgerSequence,
|
uint32_t ledgerSequence,
|
||||||
BackendInterface const& backend);
|
BackendInterface const& backend);
|
||||||
void
|
void
|
||||||
doKeysRepair(
|
doKeysRepairAsync(
|
||||||
BackendInterface const& backend,
|
BackendInterface const& backend,
|
||||||
std::optional<uint32_t> sequence);
|
std::optional<uint32_t> sequence);
|
||||||
uint32_t
|
uint32_t
|
||||||
@@ -171,7 +175,7 @@ public:
|
|||||||
auto rng = fetchLedgerRangeNoThrow();
|
auto rng = fetchLedgerRangeNoThrow();
|
||||||
if (rng && rng->minSequence != ledgerSequence)
|
if (rng && rng->minSequence != ledgerSequence)
|
||||||
isFirst_ = false;
|
isFirst_ = false;
|
||||||
indexer_.doKeysRepair(*this, ledgerSequence);
|
indexer_.doKeysRepairAsync(*this, ledgerSequence);
|
||||||
}
|
}
|
||||||
if (indexer_.isKeyFlagLedger(ledgerSequence) || isFirst_)
|
if (indexer_.isKeyFlagLedger(ledgerSequence) || isFirst_)
|
||||||
indexer_.writeKeyFlagLedgerAsync(ledgerSequence, *this);
|
indexer_.writeKeyFlagLedgerAsync(ledgerSequence, *this);
|
||||||
|
|||||||
Reference in New Issue
Block a user