Skip to content

Commit

Permalink
fix: ignore when the candle was updated, always re-send the current c…
Browse files Browse the repository at this point in the history
…andle

Signed-off-by: Elias Van Ootegem <[email protected]>
  • Loading branch information
EVODelavega committed Oct 8, 2024
1 parent 1344c3e commit c8ad7c5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions datanode/candlesv2/candle_updates.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down

0 comments on commit c8ad7c5

Please sign in to comment.