Modify the procedure of the app().run() method (#603)

This commit is contained in:
An Tao 2020-10-09 15:02:05 +08:00 committed by GitHub
parent fb7d73be06
commit 34d2fe45c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions

View File

@ -477,9 +477,7 @@ void HttpAppFrameworkImpl::run()
{
LOG_INFO << "Start child process";
}
// now start runing!!
running_ = true;
#ifndef _WIN32
if (!libFilePaths_.empty())
{
@ -507,10 +505,6 @@ void HttpAppFrameworkImpl::run()
// loop, so put the main loop into ioLoops.
ioLoops.push_back(getLoop());
dbClientManagerPtr_->createDbClients(ioLoops);
httpCtrlsRouterPtr_->init(ioLoops);
httpSimpleCtrlsRouterPtr_->init(ioLoops);
staticFileRouterPtr_->init(ioLoops);
websockCtrlsRouterPtr_->init();
if (useSession_)
{
@ -530,6 +524,13 @@ void HttpAppFrameworkImpl::run()
// TODO: new plugin
});
}
// now start runing!!
running_ = true;
httpCtrlsRouterPtr_->init(ioLoops);
httpSimpleCtrlsRouterPtr_->init(ioLoops);
staticFileRouterPtr_->init(ioLoops);
websockCtrlsRouterPtr_->init();
getLoop()->queueInLoop([this]() {
// Let listener event loops run when everything is ready.
listenerManagerPtr_->startListening();