SPARK-1359 Config key to turn off running market data

This commit is contained in:
Eric Harding committed 2018-06-22 17:31:08 -04:00
1 parent db7f74f85d
commit 840115db03
3 files changed
+25 -22

No files matched your search

+3 -1
View File
@@ -2,7 +2,9 @@ syntax='proto2';
package bts.md;
message MarketDataConfig {
optional bool use_replay = 1 [default=true];
// Allows you to turn off in-proc market data entirely
optional bool use_md = 1 [default = true];
optional bool use_replay = 2 [default=true];
}
message PlatformMap
+21 -20
View File
@@ -70,28 +70,29 @@ void run_cleanup() {
clean_dir("/dev/shm");
}
std::thread* _md_thread;
void run_market_datapublishers(bool should_return) {
bts_assert(_md_thread == nullptr);
run_cleanup();
// start a thread for the md
_md_thread = new std::thread([]() {
os::set_thread_name("md publisher");
void run_market_data_publishers_forever() {
os::set_thread_name("md publisher");
run_cleanup();
if (config::get<MarketDataConfig>().use_replay()) {
run_replay();
}
else {
run_onixs();
}
}
if (config::get<MarketDataConfig>().use_replay()) {
run_replay();
}
else {
run_onixs();
}
});
void run_market_datapublishers() {
bts_assert(_md_thread == nullptr);
if (!config::get<MarketDataConfig>().use_md()) return;
run_cleanup();
// start a thread for the md
_md_thread = new std::thread([]() {
run_market_data_publishers_forever();
});
if(should_return) {
std::this_thread::sleep_for(2s);
}
else {
_md_thread->join();
}
std::this_thread::sleep_for(2s);
}
void run_record(const std::string& arg){
@@ -209,7 +210,7 @@ void md_tool(std::vector<std::string> const &args) {
else if (cmd == "cleanup") run_cleanup();
else if (cmd == "dump") run_dump(vector<string>(args.begin()+1, args.end()));
else if (cmd == "replay") run_replay();
else if (cmd == "run") run_market_datapublishers(false);
else if (cmd == "run") run_market_data_publishers_forever();
else if (cmd == "relay") relay_everything();
else if (cmd == "test_relay") relay_everything();
else if (cmd == "dumpsecurity") dump_db(vector<string>(args.begin()+1, args.end()));
+1 -1
View File
@@ -5,7 +5,7 @@
namespace bts {
namespace md {
void run_market_datapublishers(bool should_return=true);
void run_market_datapublishers();
void md_tool(std::vector<std::string> const& args);
}}