Skip to content

Commit ce473a1

Browse files
committed
use Application::start in catchup and publish commands
Signed-off-by: Rafał Malinowski <rafal.przemyslaw.malinowski@gmail.com>
1 parent 590a82e commit ce473a1

1 file changed

Lines changed: 4 additions & 38 deletions

File tree

src/main/ApplicationUtils.cpp

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -331,25 +331,7 @@ catchup(Application::pointer app, CatchupConfiguration cc,
331331
return 1;
332332
}
333333

334-
// set known cursors before starting maintenance job
335-
ExternalQueue ps(*app);
336-
ps.setInitialCursors(app->getConfig().KNOWN_CURSORS);
337-
app->getMaintainer().start();
338-
339-
auto done = false;
340-
app->getLedgerManager().loadLastKnownLedger(
341-
[&done](asio::error_code const& ec) {
342-
if (ec)
343-
{
344-
throw std::runtime_error(
345-
"Unable to restore last-known ledger state");
346-
}
347-
348-
done = true;
349-
});
350-
auto& clock = app->getClock();
351-
while (!done && clock.crank(true))
352-
;
334+
app->start();
353335

354336
try
355337
{
@@ -367,10 +349,11 @@ catchup(Application::pointer app, CatchupConfiguration cc,
367349
return 2;
368350
}
369351

352+
auto& clock = app->getClock();
370353
auto& io = clock.getIOService();
371354
auto synced = false;
372355
asio::io_service::work mainWork(io);
373-
done = false;
356+
auto done = false;
374357
while (!done && clock.crank(true))
375358
{
376359
switch (app->getLedgerManager().getState())
@@ -434,26 +417,9 @@ publish(Application::pointer app)
434417
return 1;
435418
}
436419

437-
// set known cursors before starting maintenance job
438-
ExternalQueue ps(*app);
439-
ps.setInitialCursors(app->getConfig().KNOWN_CURSORS);
440-
app->getMaintainer().start();
441-
442-
auto done = false;
443-
app->getLedgerManager().loadLastKnownLedger(
444-
[&done](asio::error_code const& ec) {
445-
if (ec)
446-
{
447-
throw std::runtime_error(
448-
"Unable to restore last-known ledger state");
449-
}
420+
app->start();
450421

451-
done = true;
452-
});
453422
auto& clock = app->getClock();
454-
while (!done && clock.crank(true))
455-
;
456-
457423
auto& io = clock.getIOService();
458424
asio::io_service::work mainWork(io);
459425

0 commit comments

Comments
 (0)