Skip to content
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

Retry RPC commands to try to fix MacOS CI jobs #5120

Merged
merged 5 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions src/test/jtx/impl/Env.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,16 +317,24 @@ Env::submit(JTx const& jt)
auto const jr = [&]() {
if (jt.stx)
{
txid_ = jt.stx->getTransactionID();
Serializer s;
jt.stx->add(s);
auto const jr = rpc("submit", strHex(s.slice()));

parsedResult = parseResult(jr);
test.expect(parsedResult.ter, "ter uninitialized!");
ter_ = parsedResult.ter.value_or(telENV_RPC_FAILED);

return jr;
// We shouldn't need to retry, but it fixes the test on macOS for
// the moment.
int retries = 3;
ximinez marked this conversation as resolved.
Show resolved Hide resolved
do
{
txid_ = jt.stx->getTransactionID();
Serializer s;
jt.stx->add(s);
auto const jr = rpc("submit", strHex(s.slice()));

parsedResult = parseResult(jr);
test.expect(parsedResult.ter, "ter uninitialized!");
ter_ = parsedResult.ter.value_or(telENV_RPC_FAILED);
if (ter_ != telENV_RPC_FAILED ||
parsedResult.rpcCode != rpcINTERNAL ||
jt.ter == telENV_RPC_FAILED || --retries <= 0)
return jr;
} while (true);
}
else
{
Expand Down
18 changes: 0 additions & 18 deletions src/xrpld/app/misc/NetworkOPs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2783,24 +2783,6 @@ NetworkOPsImp::pubProposedTransaction(
pubProposedAccountTransaction(ledger, transaction, result);
}

static void
getAccounts(Json::Value const& jvObj, std::vector<AccountID>& accounts)
{
for (auto& jv : jvObj)
{
if (jv.isObject())
{
getAccounts(jv, accounts);
}
else if (jv.isString())
{
auto account = RPC::accountFromStringStrict(jv.asString());
if (account)
accounts.push_back(*account);
}
}
}

void
NetworkOPsImp::pubLedger(std::shared_ptr<ReadView const> const& lpAccepted)
{
Expand Down
Loading