Skip to content

Commit

Permalink
Fix scope in dist test server (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shillaker committed Jul 5, 2021
1 parent 63affca commit 9839151
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions tests/dist/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,24 @@ int main()
faabric::transport::initGlobalMessageContext();
tests::initDistTests();

SPDLOG_INFO("Starting distributed test server on worker");
std::shared_ptr<ExecutorFactory> fac =
std::make_shared<tests::DistTestExecutorFactory>();
faabric::runner::FaabricMain m(fac);
m.startBackground();

// Note, endpoint will block until killed
SPDLOG_INFO("Starting HTTP endpoint on worker");
faabric::endpoint::FaabricEndpoint endpoint;
endpoint.start();

SPDLOG_INFO("Shutting down");
m.shutdown();
// WARNING: All 0MQ operations must be contained within their own scope so
// that all sockets are destructed before the context is closed.
{
SPDLOG_INFO("Starting distributed test server on worker");
std::shared_ptr<ExecutorFactory> fac =
std::make_shared<tests::DistTestExecutorFactory>();
faabric::runner::FaabricMain m(fac);
m.startBackground();

// Note, endpoint will block until killed
SPDLOG_INFO("Starting HTTP endpoint on worker");
faabric::endpoint::FaabricEndpoint endpoint;
endpoint.start();

SPDLOG_INFO("Shutting down");
m.shutdown();
}

faabric::transport::closeGlobalMessageContext();

return EXIT_SUCCESS;
Expand Down

0 comments on commit 9839151

Please sign in to comment.