diff --git a/third-party/mcrouter/src/mcrouter/Server-inl.h b/third-party/mcrouter/src/mcrouter/Server-inl.h index 788a4542003d89..26c90c54d819fb 100644 --- a/third-party/mcrouter/src/mcrouter/Server-inl.h +++ b/third-party/mcrouter/src/mcrouter/Server-inl.h @@ -310,11 +310,6 @@ bool runServerDual( auto evbs = extractEvbs(*ioThreadPool); CHECK_EQ(evbs.size(), mcrouterOpts.num_proxies); - // Create AsyncMcServer instance - asyncMcServer = - std::make_shared(detail::createAsyncMcServerOptions( - mcrouterOpts, standaloneOpts, &evbs)); - // Create CarbonRouterInstance if (standaloneOpts.remote_thread) { router = @@ -328,6 +323,11 @@ bool runServerDual( return false; } + // Create AsyncMcServer instance + asyncMcServer = + std::make_shared(detail::createAsyncMcServerOptions( + mcrouterOpts, standaloneOpts, &evbs)); + setupRouter(mcrouterOpts, standaloneOpts, router, preRunCb); // Create CarbonRouterClients for each worker thread @@ -515,10 +515,6 @@ bool runServer( // Get EVB of main thread auto localEvb = ioThreadPool->getEventBaseManager()->getEventBase(); - asyncMcServer = - std::make_shared(detail::createAsyncMcServerOptions( - mcrouterOpts, standaloneOpts, &evbs)); - if (standaloneOpts.remote_thread) { router = CarbonRouterInstance::init("standalone", mcrouterOpts); @@ -531,6 +527,10 @@ bool runServer( return false; } + asyncMcServer = + std::make_shared(detail::createAsyncMcServerOptions( + mcrouterOpts, standaloneOpts, &evbs)); + setupRouter(mcrouterOpts, standaloneOpts, router, preRunCb); auto shutdownStarted = std::make_shared>(false);