mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-20 03:35:55 +00:00
Make database reads async
* yield on db read using asio * PostgresBackend fetches multiple transactions or objects in parallel
This commit is contained in:
@@ -85,8 +85,8 @@ doLedger(Context const& context)
|
||||
boost::json::array& jsonTxs = header.at("transactions").as_array();
|
||||
if (expand)
|
||||
{
|
||||
auto txns =
|
||||
context.backend->fetchAllTransactionsInLedger(lgrInfo.seq);
|
||||
auto txns = context.backend->fetchAllTransactionsInLedger(
|
||||
lgrInfo.seq, context.yield);
|
||||
|
||||
std::transform(
|
||||
std::move_iterator(txns.begin()),
|
||||
@@ -111,8 +111,8 @@ doLedger(Context const& context)
|
||||
}
|
||||
else
|
||||
{
|
||||
auto hashes =
|
||||
context.backend->fetchAllTransactionHashesInLedger(lgrInfo.seq);
|
||||
auto hashes = context.backend->fetchAllTransactionHashesInLedger(
|
||||
lgrInfo.seq, context.yield);
|
||||
std::transform(
|
||||
std::move_iterator(hashes.begin()),
|
||||
std::move_iterator(hashes.end()),
|
||||
@@ -128,7 +128,8 @@ doLedger(Context const& context)
|
||||
{
|
||||
header["diff"] = boost::json::value(boost::json::array_kind);
|
||||
boost::json::array& jsonDiff = header.at("diff").as_array();
|
||||
auto diff = context.backend->fetchLedgerDiff(lgrInfo.seq);
|
||||
auto diff =
|
||||
context.backend->fetchLedgerDiff(lgrInfo.seq, context.yield);
|
||||
for (auto const& obj : diff)
|
||||
{
|
||||
boost::json::object entry;
|
||||
|
||||
Reference in New Issue
Block a user