Cleaning up mercury.

This commit is contained in:
Pedro Pinto committed 2018-10-02 16:24:00 +00:00
1 parent fa2a2e2107
commit ef3b39361a
7 files changed
+37 -39

No files matched your search

+13 -11
View File
@@ -125,17 +125,6 @@ OrderServiceServer::OrderServiceServer(
me->publish_orders = make_orders_publisher();
me->publish_fills = make_fills_publisher();
me->service_bridge = new ServiceBridge(
[this]() { me->service_ready = true; },
[this, &ctx](auto const &orders) {
ctx.post([this, orders] { this->on_orders(orders); });
},
[this, &ctx](auto const &fill) {
ctx.post([this, fill] { this->on_fills(fill); });
});
std::vector<mercury::Executor*> all_executors;
for (auto const &thread_cfg : config::get<config::OrdermanCfg>().thread()) {
auto at = std::make_unique<ActorThread>(thread_cfg,stats);
@@ -201,6 +190,19 @@ OrderServiceServer::OrderServiceServer(
thread = find_thread_for_actor("ServiceBridge", me->actor_threads);
bts_assert_msg(thread, "Could not find a configured thread for ServiceBridge. See "
"the OrdermanCfg key");
me->service_bridge = new ServiceBridge(
[this]() { me->service_ready = true; },
[this, &ctx](auto const &orders) {
ctx.post([this, orders] { this->on_orders(orders); });
},
[this, &ctx](auto const &fill) {
ctx.post([this, fill] { this->on_fills(fill); });
},
thread->executor.make_proxy()
);
thread->executor.activate(me->service_bridge);
// spin up threads