Skip to content

Commit

Permalink
Updated wrapper to flush logs before exiting
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenewald committed Oct 6, 2024
1 parent 0fd7af6 commit 95fc42f
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions exchange/src/wrapper/main.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#include "wrapper/runtime/python/python_runtime.hpp"
#include "wrapper/runtime/runtime.hpp"
#include "common/logging/logging.hpp"
#include "wrapper/config/argparse.hpp"
#include "wrapper/messaging/exchange_communicator.hpp"
#include "wrapper/runtime/cpp/cpp_runtime.hpp"
#include "common/logging/logging.hpp"
#include "wrapper/runtime/python/python_runtime.hpp"
#include "wrapper/util/resource_limits.hpp"

#include <boost/algorithm/string/trim.hpp>
Expand All @@ -12,21 +11,29 @@

#include <csignal>


// We stop the exchange with sigint. The wrapper should exit gracefully
void
catch_sigint(int)
{
quill::flush();
// Wait until we're forced to terminate
while (true) {}
}

void
catch_sigterm(int)
{
quill::flush();
std::exit(0);
}

int
main(int argc, const char** argv)
{
using namespace nutc::wrapper;

std::signal(SIGINT, catch_sigint);
std::signal(SIGTERM, catch_sigterm);
auto [verbosity, trader_id, algo_type] = process_arguments(argc, argv);

ExchangeCommunicator communicator{trader_id};
Expand Down

0 comments on commit 95fc42f

Please sign in to comment.