mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-27 23:25:53 +00:00
don't create strands for cache download. output cache info in server_info
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include <backend/SimpleCache.h>
|
||||
namespace Backend {
|
||||
uint32_t
|
||||
SimpleCache::latestLedgerSequence()
|
||||
SimpleCache::latestLedgerSequence() const
|
||||
{
|
||||
std::shared_lock lck{mtx_};
|
||||
return latestSeq_;
|
||||
@@ -91,12 +91,12 @@ SimpleCache::setFull()
|
||||
}
|
||||
|
||||
bool
|
||||
SimpleCache::isFull()
|
||||
SimpleCache::isFull() const
|
||||
{
|
||||
return full_;
|
||||
}
|
||||
size_t
|
||||
SimpleCache::size()
|
||||
SimpleCache::size() const
|
||||
{
|
||||
std::shared_lock lck{mtx_};
|
||||
return map_.size();
|
||||
|
||||
@@ -49,14 +49,14 @@ public:
|
||||
setFull();
|
||||
|
||||
uint32_t
|
||||
latestLedgerSequence();
|
||||
latestLedgerSequence() const;
|
||||
|
||||
// whether the cache has all data for the most recent ledger
|
||||
bool
|
||||
isFull();
|
||||
isFull() const;
|
||||
|
||||
size_t
|
||||
size();
|
||||
size() const;
|
||||
};
|
||||
|
||||
} // namespace Backend
|
||||
|
||||
@@ -937,9 +937,8 @@ ReportingETL::loadCache(uint32_t seq)
|
||||
{
|
||||
std::optional<ripple::uint256> start = cursors[i];
|
||||
std::optional<ripple::uint256> end = cursors[i + 1];
|
||||
cacheDownloadStrands_.emplace_back(ioContext_);
|
||||
boost::asio::spawn(
|
||||
cacheDownloadStrands_.back(),
|
||||
ioContext_,
|
||||
[this, seq, start, end, numRemaining](
|
||||
boost::asio::yield_context yield) {
|
||||
std::optional<ripple::uint256> cursor = start;
|
||||
@@ -948,7 +947,7 @@ ReportingETL::loadCache(uint32_t seq)
|
||||
auto res =
|
||||
Backend::retryOnTimeout([this, seq, &cursor, &yield]() {
|
||||
return backend_->fetchLedgerPage(
|
||||
cursor, seq, 256, yield);
|
||||
cursor, seq, 256, false, yield);
|
||||
});
|
||||
backend_->cache().update(res.objects, seq, true);
|
||||
if (!res.cursor || (end && *(res.cursor) > *end))
|
||||
|
||||
@@ -67,8 +67,6 @@ private:
|
||||
/// ledgers are published in order
|
||||
boost::asio::io_context::strand publishStrand_;
|
||||
|
||||
std::vector<boost::asio::io_context::strand> cacheDownloadStrands_;
|
||||
|
||||
/// Mechanism for communicating with ETL sources. ETLLoadBalancer wraps an
|
||||
/// arbitrary number of ETL sources and load balances ETL requests across
|
||||
/// those sources.
|
||||
|
||||
@@ -29,6 +29,11 @@ doServerInfo(Context const& context)
|
||||
info["counters"] = boost::json::object{};
|
||||
info["counters"].as_object()["rpc"] = context.counters.report();
|
||||
}
|
||||
auto& cache = (response["cache"] = boost::json::object{}).as_object();
|
||||
cache["size"] = context.backend->cache().size();
|
||||
cache["is_full"] = context.backend->cache().isFull();
|
||||
cache["latest_ledger_seq"] =
|
||||
context.backend->cache().latestLedgerSequence();
|
||||
|
||||
auto serverInfoRippled = context.balancer->forwardToRippled(
|
||||
context.params, context.clientIp, context.yield);
|
||||
|
||||
Reference in New Issue
Block a user