try adding sync

This commit is contained in:
ledhed2222
2023-03-21 22:14:30 -04:00
parent 43ce030f1f
commit 4e7cf713b0
2 changed files with 17 additions and 7 deletions

View File

@@ -106,7 +106,11 @@ doMigration(
}
// write what we have
backend.writeNFTs(std::move(toWrite));
if (toWrite.size() > 0)
{
backend.writeNFTs(std::move(toWrite));
backend.sync();
}
morePages = cass_result_has_more_pages(result);
if (morePages)
@@ -134,10 +138,15 @@ doMigration(
for (auto const& object : page.objects)
{
std::string blobStr(object.blob.begin(), object.blob.end());
backend.writeNFTs(getNFTDataFromObj(
ledgerRange->minSequence,
ripple::to_string(object.key),
blobStr));
std::vector<NFTsData> toWrite = getNFTDataFromObj(
ledgerRange->minSequence,
ripple::to_string(object.key),
blobStr);
if (toWrite.size() > 0)
{
backend.writeNFTs(std::move(toWrite));
backend.sync();
}
}
cursor = page.cursor;
} while (cursor.has_value());
@@ -166,6 +175,8 @@ doMigration(
throw std::runtime_error(ss.str());
}
backend.sync();
std::cout << "Completed migration from " << ledgerRange->minSequence
<< " to " << ledgerRange->maxSequence << std::endl;
}
@@ -202,7 +213,6 @@ main(int argc, char* argv[])
boost::asio::spawn(
ioc, [&backend, &work](boost::asio::yield_context yield) {
doMigration(*backend, yield);
backend->sync();
work.reset();
});