From 8e5bf1b053bed0d68313939437d110623bde0cc0 Mon Sep 17 00:00:00 2001 From: Ed Hennis Date: Mon, 20 Jul 2026 12:46:21 -0400 Subject: [PATCH] Don't wait as long for ledgers that should be build soon --- src/xrpld/app/misc/SHAMapStoreImp.cpp | 28 ++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/xrpld/app/misc/SHAMapStoreImp.cpp b/src/xrpld/app/misc/SHAMapStoreImp.cpp index 04a34b796a..afd7eb9553 100644 --- a/src/xrpld/app/misc/SHAMapStoreImp.cpp +++ b/src/xrpld/app/misc/SHAMapStoreImp.cpp @@ -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 { + 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(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;