Make database reads async

* yield on db read using asio
* PostgresBackend fetches multiple transactions or objects in parallel
This commit is contained in:
natenichols
2022-02-07 07:00:15 -06:00
committed by CJ Cobb
parent 7c2bef70bc
commit d016253264
50 changed files with 3612 additions and 2593 deletions

View File

@@ -30,12 +30,15 @@ doServerInfo(Context const& context)
info["counters"].as_object()["rpc"] = context.counters.report();
}
auto serverInfoRippled =
context.balancer->forwardToRippled(context.params, context.clientIp);
auto serverInfoRippled = context.balancer->forwardToRippled(
context.params, context.clientIp, context.yield);
if (serverInfoRippled && !serverInfoRippled->contains("error"))
response["info"].as_object()["load_factor"] = 1;
auto lgrInfo = context.backend->fetchLedgerBySequence(range->maxSequence);
auto lgrInfo = context.backend->fetchLedgerBySequence(
range->maxSequence, context.yield);
assert(lgrInfo.has_value());
auto age = std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now().time_since_epoch())
@@ -46,7 +49,7 @@ doServerInfo(Context const& context)
validatedLgr["age"] = age;
validatedLgr["hash"] = ripple::strHex(lgrInfo->hash);
validatedLgr["seq"] = lgrInfo->seq;
auto fees = context.backend->fetchFees(lgrInfo->seq);
auto fees = context.backend->fetchFees(lgrInfo->seq, context.yield);
assert(fees.has_value());
validatedLgr["base_fee_xrp"] = fees->base.decimalXRP();
validatedLgr["reserve_base_xrp"] = fees->reserve.decimalXRP();