Skip to content

Commit 1c6a500

Browse files
authored
Merge pull request moby#3733 from tonistiigi/fix-history-sort
llbsolver: fix sorting of history records
2 parents deba876 + f6d1845 commit 1c6a500

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

solver/llbsolver/history.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ func (h *HistoryQueue) gc() error {
102102
}
103103

104104
// in order for record to get deleted by gc it exceed both maxentries and maxage criteria
105-
106105
if len(records) < int(h.CleanConfig.MaxEntries) {
107106
return nil
108107
}
109108

109+
// sort array by newest records first
110110
sort.Slice(records, func(i, j int) bool {
111-
return records[i].CompletedAt.Before(*records[j].CompletedAt)
111+
return records[i].CompletedAt.After(*records[j].CompletedAt)
112112
})
113113

114114
h.mu.Lock()

0 commit comments

Comments
 (0)