Skip to content
Prev Previous commit
Next Next commit
deterministic job ordering in time range planner
  • Loading branch information
owen-d committed Dec 3, 2024
commit f7c10b43ddaac8f2cdba8499e73c56464e816b35
6 changes: 6 additions & 0 deletions pkg/blockbuilder/scheduler/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package scheduler

import (
"context"
"sort"
"time"

"github.com/go-kit/log"
Expand Down Expand Up @@ -138,5 +139,10 @@ func (p *TimeRangePlanner) Plan(ctx context.Context) ([]types.Job, error) {
})
}

// Sort jobs by partition number to ensure consistent ordering
sort.Slice(jobs, func(i, j int) bool {
return jobs[i].Partition < jobs[j].Partition
})

return jobs, nil
}