mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-01 00:55:51 +00:00
impliment book offers for async etl
This commit is contained in:
@@ -280,16 +280,16 @@ doBookOffers(
|
||||
}
|
||||
|
||||
auto start = std::chrono::system_clock::now();
|
||||
std::cout << "getting Book Offers" << std::endl;
|
||||
auto [offers, retCursor] =
|
||||
auto [offers, retCursor, warning] =
|
||||
backend.fetchBookOffers(bookBase, *ledgerSequence, limit, cursor);
|
||||
std::cout << "got Book Offers" << std::endl;
|
||||
|
||||
auto end = std::chrono::system_clock::now();
|
||||
|
||||
BOOST_LOG_TRIVIAL(warning) << "Time loading books from Postgres: "
|
||||
BOOST_LOG_TRIVIAL(warning) << "Time loading books: "
|
||||
<< ((end - start).count() / 1000000000.0);
|
||||
|
||||
if(warning)
|
||||
response["warning"] = *warning;
|
||||
|
||||
response["offers"] = boost::json::value(boost::json::array_kind);
|
||||
boost::json::array& jsonOffers = response.at("offers").as_array();
|
||||
|
||||
@@ -324,6 +324,11 @@ doBookOffers(
|
||||
<< ((end - start).count() / 1000000000.0);
|
||||
if (retCursor)
|
||||
response["cursor"] = ripple::strHex(*retCursor);
|
||||
if (warning)
|
||||
response["warning"] =
|
||||
"Periodic database update in progress. Data for this book as of "
|
||||
"this ledger "
|
||||
"may be incomplete. Data should be complete within one minute";
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -100,6 +100,16 @@ doLedgerData(
|
||||
response["num_results"] = results.size();
|
||||
response["db_time"] = time;
|
||||
response["time_per_result"] = time / (results.size() ? results.size() : 1);
|
||||
if (page.warning)
|
||||
{
|
||||
response["warning"] =
|
||||
"Periodic database update in progress. Data for this ledger may be "
|
||||
"incomplete. Data should be complete "
|
||||
"within a few minutes. Other RPC calls are not affected, "
|
||||
"regardless of ledger. This "
|
||||
"warning is only present on the first "
|
||||
"page of the ledger";
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user