mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-19 18:45:52 +00:00
Load PeerFinder database in Stoppable::onPrepare:
OverlayImpl::onStart calls into PeerFinder before PeerFinder::Manager::onStart, causing tests to sometimes fail and the application to intermittently not start. The order of calls to Stoppable::onStart is implementation defined and not predictable. This changes PeerFinder to load the database in Stoppable::onPrepare, before threads are launched. In general, creation and initialization of resources that are shared between classes should happen in onPrepare rather than onStart, to solve this problem.
This commit is contained in:
@@ -201,14 +201,9 @@ public:
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
void onPrepare ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
onStart()
|
||||
onPrepare ()
|
||||
{
|
||||
m_journal.debug << "Initializing";
|
||||
beast::Error error (m_store.open (m_databaseFile));
|
||||
if (error)
|
||||
m_journal.fatal <<
|
||||
@@ -217,6 +212,11 @@ public:
|
||||
m_logic.load ();
|
||||
}
|
||||
|
||||
void
|
||||
onStart()
|
||||
{
|
||||
}
|
||||
|
||||
void onStop ()
|
||||
{
|
||||
m_journal.debug << "Stopping";
|
||||
|
||||
Reference in New Issue
Block a user