From c8ad7c5efbe85354cec9b8c180ab85b6b133ad1c Mon Sep 17 00:00:00 2001 From: Elias Van Ootegem Date: Tue, 8 Oct 2024 18:02:42 +0100 Subject: [PATCH] fix: ignore when the candle was updated, always re-send the current candle Signed-off-by: Elias Van Ootegem --- datanode/candlesv2/candle_updates.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/datanode/candlesv2/candle_updates.go b/datanode/candlesv2/candle_updates.go index 7bacfe29ba..90dc33e793 100644 --- a/datanode/candlesv2/candle_updates.go +++ b/datanode/candlesv2/candle_updates.go @@ -248,10 +248,10 @@ func (s *CandleUpdates) getCandleUpdates(ctx context.Context, now time.Time) ([] } // allocate slice rather than doubling cap as we go. - updates = make([]entities.Candle, 0, len(candles)) + updates = make([]entities.Candle, 0, len(candles)+1) for _, candle := range candles { - // not before so either newer, or the same (last) candle should be returned. - if !candle.LastUpdateInPeriod.Before(s.lastCandle.LastUpdateInPeriod) || !candle.PeriodStart.Before(s.lastCandle.PeriodStart) { + // last candle or newer should be considered an update. + if !candle.PeriodStart.Before(s.lastCandle.PeriodStart) { updates = append(updates, candle) } }