impliment book offers for async etl

This commit is contained in:
Nathan Nichols
2021-05-06 23:07:52 -05:00
12 changed files with 534 additions and 347 deletions

View File

@@ -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;
}