Skip to content

Commit 78acb5d

Browse files
authored
fix: missed validation of subscriptionManager in reconnection logic (#34)
1 parent cbe82ad commit 78acb5d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

QuantConnect.AlpacaBrokerage/AlpacaBrokerage.cs

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
33
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
44
*
@@ -654,10 +654,14 @@ private void RunReconnectionLogic(int secondsDelay)
654654
}
655655
else
656656
{
657-
// resubscribe
658-
var symbols = _subscriptionManager.GetSubscribedSymbols();
659-
Unsubscribe(symbols);
660-
Subscribe(symbols);
657+
// if we are used as a brokerage ignore data queue handler updates
658+
if (_subscriptionManager != null)
659+
{
660+
// resubscribe
661+
var symbols = _subscriptionManager.GetSubscribedSymbols();
662+
Unsubscribe(symbols);
663+
Subscribe(symbols);
664+
}
661665
// let consumers know we are reconnected, avoid lean killing us
662666
OnMessage(new BrokerageMessageEvent(BrokerageMessageType.Reconnect, "Reconnected", "Brokerage Reconnected"));
663667
}

0 commit comments

Comments
 (0)