mirror of
https://github.com/XRPLF/clio.git
synced 2026-07-26 08:30:24 +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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user