Tariffs: sort by time when merging rate updates

This commit is contained in:
andig 2025-10-14 14:06:55 +02:00
parent 173f4e5bc2
commit c44939ceee

View file

@ -48,6 +48,8 @@ func mergeRates(data *util.Monitor[api.Rates], new api.Rates) {
// mergeRatesAfter blends new and existing rates, keeping existing rates after timestamp
func mergeRatesAfter(data *util.Monitor[api.Rates], new api.Rates, now time.Time) {
new.Sort()
var newStart time.Time
if len(new) > 0 {
new.Sort()