Permit pathfinding to be disabled. (RIPD-271)

If you do not need pathfinding, you can disable it and save some
resources by setting path_search_max to zero in your config file.
This commit is contained in:
JoelKatz
2015-10-19 14:32:45 -07:00
committed by Nik Bougalis
parent 45f00362db
commit 75bed5efcf
4 changed files with 20 additions and 1 deletions

View File

@@ -527,6 +527,9 @@
# [path_search_max]
# When searching for paths, the minimum and maximum search aggressiveness.
#
# If you do not need pathfinding, you can set path_search_max to zero to
# disable it and avoid some expensive bookkeeping.
#
# The default for 'path_search_fast' is 2. The default for 'path_search_max' is 10.
#
# [path_search_old]

View File

@@ -66,7 +66,11 @@ void OrderBookDB::setup(
mSeq = seq;
}
if (app_.config().RUN_STANDALONE)
if (app_.config().PATH_SEARCH_MAX == 0)
{
// nothing to do
}
else if (app_.config().RUN_STANDALONE)
update(ledger);
else
app_.getJobQueue().addJob(
@@ -84,6 +88,12 @@ void OrderBookDB::update(
JLOG (j_.debug) << "OrderBookDB::update>";
if (app_.config().PATH_SEARCH_MAX == 0)
{
// pathfinding has been disabled
return;
}
// walk through the entire ledger looking for orderbook entries
int books = 0;

View File

@@ -32,6 +32,9 @@ namespace ripple {
Json::Value doPathFind (RPC::Context& context)
{
if (context.app.config().PATH_SEARCH_MAX == 0)
return rpcError (rpcNOT_SUPPORTED);
auto lpLedger = context.ledgerMaster.getClosedLedger();
if (!context.params.isMember (jss::subcommand) ||

View File

@@ -70,6 +70,9 @@ buildSrcCurrencies(AccountID const& account,
// This interface is deprecated.
Json::Value doRipplePathFind (RPC::Context& context)
{
if (context.app.config().PATH_SEARCH_MAX == 0)
return rpcError (rpcNOT_SUPPORTED);
RPC::LegacyPathFind lpf (context.role == Role::ADMIN, context.app);
if (!lpf.isOk ())
return rpcError (rpcTOO_BUSY);