fix(ftx): use select to handle kline message

This commit is contained in:
Jui-Nan Lin 2021-05-24 10:00:43 +08:00
parent bbeafab59b
commit bd9a61ea97

View File

@ -132,14 +132,11 @@ func (s *Stream) Subscribe(channel types.Channel, symbol string, option types.Su
func (s *Stream) handleChannelKlineMessage() {
for {
kline := <-s.klineMessage
if kline.Closed {
select {
case kline := <-s.klineMessage:
// FTX only returns closed kline
s.EmitKLineClosed(kline)
continue
}
s.EmitKLine(kline)
}
}