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

@@ -802,7 +802,8 @@ transactionSubmit(
Role role,
std::chrono::seconds validatedLedgerAge,
Application& app,
ProcessTransactionFn const& processTransaction)
ProcessTransactionFn const& processTransaction,
RPC::SubmitSync sync)
{
using namespace detail;
@@ -828,8 +829,7 @@ transactionSubmit(
// Finally, submit the transaction.
try
{
// FIXME: For performance, should use asynch interface
processTransaction(txn.second, isUnlimited(role), true, failType);
processTransaction(txn.second, isUnlimited(role), sync, failType);
}
catch (std::exception&)
{
@@ -1038,7 +1038,8 @@ transactionSubmitMultiSigned(
Role role,
std::chrono::seconds validatedLedgerAge,
Application& app,
ProcessTransactionFn const& processTransaction)
ProcessTransactionFn const& processTransaction,
RPC::SubmitSync sync)
{
auto const& ledger = app.openLedger().current();
auto j = app.journal("RPCHandler");
@@ -1211,7 +1212,7 @@ transactionSubmitMultiSigned(
try
{
// FIXME: For performance, should use asynch interface
processTransaction(txn.second, isUnlimited(role), true, failType);
processTransaction(txn.second, isUnlimited(role), sync, failType);
}
catch (std::exception&)
{