Apply transaction batches in periodic intervals (#4504)

Add new transaction submission API field, "sync", which
determines behavior of the server while submitting transactions:
1) sync (default): Process transactions in a batch immediately,
   and return only once the transaction has been processed.
2) async: Put transaction into the batch for the next processing
   interval and return immediately.
3) wait: Put transaction into the batch for the next processing
   interval and return only after it is processed.
This commit is contained in:
Mark Travis
2023-09-11 15:47:40 -07:00
committed by GitHub
parent 1d9db1bfdd
commit 002893f280
24 changed files with 398 additions and 163 deletions

View File

@@ -17,6 +17,7 @@
*/
//==============================================================================
#include <ripple/app/misc/NetworkOPs.h>
#include <ripple/beast/unit_test.h>
#include <ripple/core/JobQueue.h>
#include <ripple/protocol/jss.h>
@@ -88,7 +89,8 @@ public:
}
BEAST_EXPECT(jv[jss::result][jss::engine_result] == "tefPAST_SEQ");
// Submit future sequence transaction
// Submit future sequence transaction -- this transaction should be
// held until the sequence gap is closed.
payment[jss::tx_json][sfSequence.fieldName] = env.seq("alice") + 1;
jv = wsc->invoke("submit", payment);
if (wsc->version() == 2)
@@ -114,6 +116,8 @@ public:
}
BEAST_EXPECT(jv[jss::result][jss::engine_result] == "tesSUCCESS");
// Apply held transactions.
env.app().getOPs().transactionBatch(true);
// Wait for the jobqueue to process everything
env.app().getJobQueue().rendezvous();