ServiceBridge now periodically publishes the TheoEvent (with a flag indicating such). This helps the algos get the theos without waiting for the next update

This commit is contained in:
Taha Afzal committed 2022-12-04 20:36:10 -05:00
1 parent 1e0ac46e07
commit 29eef77099
7 files changed
+52 -12

No files matched your search

+13 -2
View File
@@ -128,8 +128,8 @@ struct OrderServiceServer::PImpl {
DynamicOrderRegistry const &d,
metrics::MetricsContainer &stats,
trace::PerfLog &log)
: service_bridge(), service_ready(false), known_orders(), known_fills(),
publish_orders(), publish_fills(),
: context(ctx), service_bridge(), service_ready(false), known_orders(),
known_fills(), publish_orders(), publish_fills(),
exchange_pos_publisher(exchange_pos_publisher),
open_orders_publisher(open_orders_publisher),
admin_service(ctx.locate<api::admin::AdminService>()),
@@ -139,6 +139,7 @@ struct OrderServiceServer::PImpl {
dyn_order_registry(d), log(log), in_flight_order_ops(),
current_req_op_id(0) {}
bts::api::ServiceContext &context;
ServiceBridge *service_bridge;
std::vector<std::unique_ptr<ActorThread>> actor_threads;
@@ -323,6 +324,11 @@ OrderServiceServer::OrderServiceServer(
[this](auto const &update) {
me->service_bridge->update_excess_liquidity_report(update);
});
// We wait long enough for the server to be fully ready. This is not great,
// we should watch for some signal but right now I am not sure if such a
// signal exist. We cant do it too early either or some other problem
// happens. We will come to this later and fix it
me->context.post([this]() { _do_work(); }, 300000);
}
OrderServiceServer::~OrderServiceServer() {
@@ -589,5 +595,10 @@ void OrderServiceServer::_on_exchange_open_orders(
me->open_orders_publisher.flush();
}
void OrderServiceServer::_do_work() {
me->service_bridge->do_work();
me->context.post([this]() { _do_work(); }, 500);
}
} // namespace orderman
} // namespace bts