-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maximum Transactions in JobQueue read from Config #3562
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! Thanks for your first contribution and also for being mindful enough to edit the example configuration file to reflect the new tunable.
I left a small comment that should be trivial to address.
You should also consider renaming your commit message to adhere to best practices. I recommend:
Make the transaction job queue limit adjustable
src/ripple/overlay/impl/PeerImp.cpp
Outdated
// The maximum number of transactions to have in the job queue. | ||
constexpr int max_transactions = 250; | ||
if (app_.getJobQueue().getJobCount(jtTRANSACTION) > max_transactions) | ||
if (app_.getJobQueue().getJobCount(jtTRANSACTION) > max_transactions_) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider instead:
if (app_.getJobQueueCount().getJobCount(jtTRANSACTION) > app_.config().MAX_TRANSACTIONS)
Rationale: the variable is only set in one place and isn't "per-peer" so this lets you eliminate the unnecessary member variable, and highlights the intent of the code.
c2b8857
to
009c527
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good and works fine!
High Level Overview of Change
Fixes #3556. max_transactions is now read from the
rippled.cfg
instead of hardcoded.Context of Change
The maximum capacity of
JobQueue
was hardcoded inPeerImp.cpp
. Now the maximum capacity is read from the configuration file.max_transactions
defaults to 250, and has a hardcoded minimum of 100 and a hardcoded maximum of 1000, as suggested in the issue description.This option is added to the configuration with:
Type of Change
Before/After
Before:
max_transactions was hardcoded.
After:
MAX_TRANSACTIONS
is read fromrippled.cfg
inConfig.cpp
.std::clamp
is used to ensure the configuration value is between 100 and 1000. Member variablemax_transactions_
was created inPeerImp
, and initialized to the value read by the configuration.Test Plan
All unit tests pass. No tests added.