mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 11:05:54 +00:00
Compare commits
5 Commits
a1q123456/
...
ximinez/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a16aa5b12f | ||
|
|
ef2de81870 | ||
|
|
fce6757260 | ||
|
|
d759a0a2b0 | ||
|
|
d2dda416e8 |
@@ -129,7 +129,12 @@ ValidatorSite::load(
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
sites_.emplace_back(uri);
|
// This is not super efficient, but it doesn't happen often.
|
||||||
|
bool found = std::ranges::any_of(sites_, [&uri](auto const& site) {
|
||||||
|
return site.loadedResource->uri == uri;
|
||||||
|
});
|
||||||
|
if (!found)
|
||||||
|
sites_.emplace_back(uri);
|
||||||
}
|
}
|
||||||
catch (std::exception const& e)
|
catch (std::exception const& e)
|
||||||
{
|
{
|
||||||
@@ -191,6 +196,17 @@ ValidatorSite::setTimer(
|
|||||||
std::lock_guard<std::mutex> const& site_lock,
|
std::lock_guard<std::mutex> const& site_lock,
|
||||||
std::lock_guard<std::mutex> const& state_lock)
|
std::lock_guard<std::mutex> const& state_lock)
|
||||||
{
|
{
|
||||||
|
if (!sites_.empty() && //
|
||||||
|
std::ranges::all_of(sites_, [](auto const& site) {
|
||||||
|
return site.lastRefreshStatus.has_value();
|
||||||
|
}))
|
||||||
|
{
|
||||||
|
// If all of the sites have been handled at least once (including
|
||||||
|
// errors and timeouts), call missingSite, which will load the cache
|
||||||
|
// files for any lists that are still unavailable.
|
||||||
|
missingSite(site_lock);
|
||||||
|
}
|
||||||
|
|
||||||
auto next = std::min_element(
|
auto next = std::min_element(
|
||||||
sites_.begin(), sites_.end(), [](Site const& a, Site const& b) {
|
sites_.begin(), sites_.end(), [](Site const& a, Site const& b) {
|
||||||
return a.nextRefresh < b.nextRefresh;
|
return a.nextRefresh < b.nextRefresh;
|
||||||
@@ -303,13 +319,16 @@ ValidatorSite::onRequestTimeout(std::size_t siteIdx, error_code const& ec)
|
|||||||
// processes a network error. Usually, this function runs first,
|
// processes a network error. Usually, this function runs first,
|
||||||
// but on extremely rare occasions, the response handler can run
|
// but on extremely rare occasions, the response handler can run
|
||||||
// first, which will leave activeResource empty.
|
// first, which will leave activeResource empty.
|
||||||
auto const& site = sites_[siteIdx];
|
auto& site = sites_[siteIdx];
|
||||||
if (site.activeResource)
|
if (site.activeResource)
|
||||||
JLOG(j_.warn()) << "Request for " << site.activeResource->uri
|
JLOG(j_.warn()) << "Request for " << site.activeResource->uri
|
||||||
<< " took too long";
|
<< " took too long";
|
||||||
else
|
else
|
||||||
JLOG(j_.error()) << "Request took too long, but a response has "
|
JLOG(j_.error()) << "Request took too long, but a response has "
|
||||||
"already been processed";
|
"already been processed";
|
||||||
|
if (!site.lastRefreshStatus)
|
||||||
|
site.lastRefreshStatus.emplace(Site::Status{
|
||||||
|
clock_type::now(), ListDisposition::invalid, "timeout"});
|
||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard lock_state{state_mutex_};
|
std::lock_guard lock_state{state_mutex_};
|
||||||
|
|||||||
Reference in New Issue
Block a user