Fix startup error with --import

This commit is contained in:
Mike Ellery
2019-09-17 16:28:21 -07:00
committed by Manoj doshi
parent 8ce1c189f7
commit 80acc85e59

View File

@@ -19,6 +19,7 @@
#include <ripple/app/main/Application.h>
#include <ripple/core/DatabaseCon.h>
#include <ripple/core/Stoppable.h>
#include <ripple/app/consensus/RCLValidations.h>
#include <ripple/app/main/DBInit.h>
#include <ripple/app/main/BasicApp.h>
@@ -930,21 +931,31 @@ public:
if (config_->doImport)
{
auto j = logs_->journal("NodeObject");
NodeStore::DummyScheduler scheduler;
NodeStore::DummyScheduler dummyScheduler;
RootStoppable dummyRoot {"DummyRoot"};
std::unique_ptr <NodeStore::Database> source =
NodeStore::Manager::instance().make_Database(
"NodeStore.import",
scheduler,
dummyScheduler,
0,
*m_jobQueue,
dummyRoot,
config_->section(ConfigSection::importNodeDatabase()),
j);
JLOG(j.warn()) <<
"Node import from '" << source->getName() << "' to '" <<
getNodeStore().getName() << "'.";
"Starting node import from '" << source->getName() <<
"' to '" << getNodeStore().getName() << "'.";
using namespace std::chrono;
auto const start = steady_clock::now();
getNodeStore().import(*source);
auto const elapsed = duration_cast <seconds>
(steady_clock::now() - start);
JLOG(j.warn()) <<
"Node import from '" << source->getName() <<
"' took " << elapsed.count() << " seconds.";
}
// tune caches