Don't wait as long for ledgers that should be build soon

This commit is contained in:
Ed Hennis
2026-07-20 12:46:21 -04:00
parent 01efe003fd
commit e419f69321

View File

@@ -408,6 +408,8 @@ SHAMapStoreImp::run()
}
};
RotationExposureGuard const rotationExposureGuard{*dbRotating_};
// Anything before lastRotated is going to get deleted soon, so we don't care about
// moving it to the writable DB.
dbRotating_->setRotationInFlight(lastRotated);
JLOG(journal_.debug()) << "freshening caches";
@@ -755,18 +757,26 @@ SHAMapStoreImp::healthWait()
ScopeUnlock const unlock(lock);
auto const stream = std::invoke([mode, age, ageThreshold, index, lastLedger, this]() {
if (mode != OperatingMode::FULL || age > ageThreshold)
return journal_.warn();
if (index != lastLedger)
return journal_.trace();
return journal_.info();
});
JLOG(stream) << "Waiting " << waitTime.count() << "s for node to stabilize. state: "
auto const [stream, waitMs] = std::invoke(
[mode, age, ageThreshold, index, lastLedger, waitTime, this]()
-> std::pair<beast::Journal::Stream, std::chrono::milliseconds> {
if (mode != OperatingMode::FULL || age > ageThreshold)
return {journal_.warn(), waitTime};
if (index != lastLedger)
{
// We expect this ledger to be built soon, so log at a lower level, and don't
// wait as long.
return {
journal_.trace(),
std::chrono::duration_cast<std::chrono::milliseconds>(waitTime) / 4};
}
return {journal_.info(), waitTime};
});
JLOG(stream) << "Waiting " << waitMs.count() << "ms for node to stabilize. state: "
<< app_.getOPs().strOperatingMode(mode, false) << ". age " << age.count()
<< "s. Missing ledgers: " << numMissing << ". Expect: " << lowerBound << "-"
<< index << ". Complete ledgers: " << ledgerMaster_->getCompleteLedgers();
std::this_thread::sleep_for(waitTime);
std::this_thread::sleep_for(waitMs);
readServerStatus(index, age, mode, numMissing, lowerBound, unlock);
lastLedger = index;