diff --git a/src/ripple/app/main/Application.cpp b/src/ripple/app/main/Application.cpp index b9b60767b..f8f1690f2 100644 --- a/src/ripple/app/main/Application.cpp +++ b/src/ripple/app/main/Application.cpp @@ -1065,7 +1065,8 @@ public: { using namespace std::chrono; sweepTimer_.expires_from_now( - seconds{config_->getValueFor(SizedItem::sweepInterval)}); + seconds{config_->SWEEP_INTERVAL.value_or( + config_->getValueFor(SizedItem::sweepInterval))}); sweepTimer_.async_wait(std::move(*optionalCountedHandler)); } } diff --git a/src/ripple/core/Config.h b/src/ripple/core/Config.h index 30117ad13..ea5044c2d 100644 --- a/src/ripple/core/Config.h +++ b/src/ripple/core/Config.h @@ -204,6 +204,10 @@ public: // Thread pool configuration std::size_t WORKERS = 0; + // Normally the sweep timer is automatically deduced based on the node + // size, but we allow admins to explicitly set it in the config. + std::optional SWEEP_INTERVAL; + // Reduce-relay - these parameters are experimental. // Enable reduce-relay features // Validation/proposal reduce-relay feature diff --git a/src/ripple/core/ConfigSections.h b/src/ripple/core/ConfigSections.h index 1c06e75d9..fbe425b43 100644 --- a/src/ripple/core/ConfigSections.h +++ b/src/ripple/core/ConfigSections.h @@ -98,6 +98,7 @@ struct ConfigSection #define SECTION_WORKERS "workers" #define SECTION_LEDGER_REPLAY "ledger_replay" #define SECTION_BETA_RPC_API "beta_rpc_api" +#define SECTION_SWEEP_INTERVAL "sweep_interval" } // namespace ripple diff --git a/src/ripple/core/impl/Config.cpp b/src/ripple/core/impl/Config.cpp index 08c30f0da..b5a9677e2 100644 --- a/src/ripple/core/impl/Config.cpp +++ b/src/ripple/core/impl/Config.cpp @@ -627,6 +627,15 @@ Config::loadFromString(std::string const& fileContents) if (getSingleSection(secConfig, SECTION_DEBUG_LOGFILE, strTemp, j_)) DEBUG_LOGFILE = strTemp; + if (getSingleSection(secConfig, SECTION_SWEEP_INTERVAL, strTemp, j_)) + { + SWEEP_INTERVAL = beast::lexicalCastThrow(strTemp); + + if (SWEEP_INTERVAL < 10 || SWEEP_INTERVAL > 600) + Throw("Invalid " SECTION_SWEEP_INTERVAL + ": must be between 10 and 600 inclusive"); + } + if (getSingleSection(secConfig, SECTION_WORKERS, strTemp, j_)) WORKERS = beast::lexicalCastThrow(strTemp);