Properly handle empty optionals in DB lookups

This commit is contained in:
CJ Cobb
2021-11-05 15:34:20 -04:00
committed by seelabs
parent 19018e8959
commit 970711f1fd
2 changed files with 9 additions and 9 deletions

View File

@@ -941,7 +941,7 @@ ETLLoadBalancer::execute(Func f, uint32_t ledgerSequence)
<< "Error executing function. "
<< " Tried all sources, but ledger was found in db."
<< " Sequence = " << ledgerSequence;
break;
return false;
}
JLOG(journal_.error())
<< __func__ << " : "

View File

@@ -524,14 +524,6 @@ ReportingETL::runETLPipeline(uint32_t startSequence)
auto start = std::chrono::system_clock::now();
std::optional<org::xrpl::rpc::v1::GetLedgerResponse> fetchResponse{
fetchLedgerDataAndDiff(currentSequence)};
auto end = std::chrono::system_clock::now();
auto time = ((end - start).count()) / 1000000000.0;
auto tps =
fetchResponse->transactions_list().transactions_size() / time;
JLOG(journal_.debug()) << "Extract phase time = " << time
<< " . Extract phase tps = " << tps;
// if the fetch is unsuccessful, stop. fetchLedger only returns
// false if the server is shutting down, or if the ledger was
// found in the database (which means another process already
@@ -543,6 +535,14 @@ ReportingETL::runETLPipeline(uint32_t startSequence)
{
break;
}
auto end = std::chrono::system_clock::now();
auto time = ((end - start).count()) / 1000000000.0;
auto tps =
fetchResponse->transactions_list().transactions_size() / time;
JLOG(journal_.debug()) << "Extract phase time = " << time
<< " . Extract phase tps = " << tps;
transformQueue.push(std::move(fetchResponse));
++currentSequence;