From bd9a61ea97fd957b07e26679feb12fd7f33c8875 Mon Sep 17 00:00:00 2001 From: Jui-Nan Lin Date: Mon, 24 May 2021 10:00:43 +0800 Subject: [PATCH] fix(ftx): use select to handle kline message --- pkg/exchange/ftx/stream.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pkg/exchange/ftx/stream.go b/pkg/exchange/ftx/stream.go index f09e6f025..8b99c1099 100644 --- a/pkg/exchange/ftx/stream.go +++ b/pkg/exchange/ftx/stream.go @@ -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) } }