Merge branch 'develop' into ximinez/online-delete-gaps

This commit is contained in:
Ed Hennis
2026-06-15 21:32:49 -04:00
committed by GitHub
6 changed files with 114 additions and 46 deletions

View File

@@ -30,6 +30,7 @@
#include <expected>
#include <limits>
#include <memory>
#include <string>
#include <utility>
namespace xrpl {
@@ -349,13 +350,15 @@ doLedgerGrpc(RPC::GRPCContext<org::xrpl::rpc::v1::GetLedgerRequest>& context)
auto end = std::chrono::system_clock::now();
auto duration =
std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count() * 1.0;
// Guard the per-item rates: an empty ledger has zero objects and/or zero
// transactions, and dividing by zero is undefined for these doubles.
auto const numObjects = response.ledger_objects().objects_size();
auto const numTxns = response.transactions_list().transactions_size();
std::string const msPerObj = numObjects > 0 ? std::to_string(duration / numObjects) : "n/a";
std::string const msPerTxn = numTxns > 0 ? std::to_string(duration / numTxns) : "n/a";
JLOG(context.j.warn()) << __func__ << " - Extract time = " << duration
<< " - num objects = " << response.ledger_objects().objects_size()
<< " - num txns = " << response.transactions_list().transactions_size()
<< " - ms per obj "
<< duration / response.ledger_objects().objects_size()
<< " - ms per txn "
<< duration / response.transactions_list().transactions_size();
<< " - num objects = " << numObjects << " - num txns = " << numTxns
<< " - ms per obj " << msPerObj << " - ms per txn " << msPerTxn;
return {response, status};
}