Makd SecurityCache external to MDConsumer so it live beyond md recovery
This commit is contained in:
1 parent
40a115de7e
commit
791b0fdbc1
13 files changed
+68
-40
No files matched your search
@@ -1,5 +1,6 @@
|
||||
#include "MDClient.h"
|
||||
#include "get_symbols.h"
|
||||
#include "SecurityCache.h"
|
||||
#include <set>
|
||||
|
||||
namespace bts {
|
||||
@@ -8,6 +9,7 @@ namespace md {
|
||||
struct MDClientImpl{
|
||||
utils::Dispatcher& _dispatcher;
|
||||
std::shared_ptr<api::ISyntheticSecurityService> _ss;
|
||||
SecurityCache _cache;
|
||||
utils::DispatcherTimer _security_timer;
|
||||
utils::DispatcherTimer _recovery_timer;
|
||||
MDConsumer _consumer;
|
||||
@@ -18,7 +20,7 @@ struct MDClientImpl{
|
||||
_ss(s),
|
||||
_security_timer(d, config::get<RelayOptions>().security_scan_interval(),[this]() { scan_securities(); }),
|
||||
_recovery_timer(d, config::get<RelayOptions>().recovery_interval(), [this]() { check_heartbeats(); }),
|
||||
_consumer(s,true),
|
||||
_consumer(s, _cache),
|
||||
_event()
|
||||
{
|
||||
_security_timer.start();
|
||||
@@ -37,7 +39,7 @@ struct MDClientImpl{
|
||||
|
||||
void check_heartbeats() {
|
||||
if (!_consumer.all_heartbeats_ok()) {
|
||||
MDConsumer temp(symbols(), _ss);
|
||||
MDConsumer temp(_ss,_cache);
|
||||
if (temp.all_heartbeats_ok()) {
|
||||
_consumer.swap(temp);
|
||||
LOG(md,Info, "Recovering from bad MD. Old consumer {} new consumer {}", _consumer.id(), temp.id());
|
||||
|
||||
Reference in new issue
Block a user