remotecache: other fix to record sorting

Signed-off-by: Mark Gordon <msg555@gmail.com>
docker-19.03
Mark Gordon 2019-08-08 12:29:05 -04:00
parent f5a55a9516
commit 3c3dac0a5b
1 changed files with 6 additions and 2 deletions

View File

@ -78,10 +78,14 @@ func sortConfig(cc *CacheConfig) {
if ri.Inputs[i][j].Selector != rj.Inputs[i][j].Selector {
return ri.Inputs[i][j].Selector < rj.Inputs[i][j].Selector
}
return cc.Records[ri.Inputs[i][j].LinkIndex].Digest < cc.Records[rj.Inputs[i][j].LinkIndex].Digest
inputDigesti := cc.Records[ri.Inputs[i][j].LinkIndex].Digest
inputDigestj := cc.Records[rj.Inputs[i][j].LinkIndex].Digest
if inputDigesti != inputDigestj {
return inputDigesti < inputDigestj
}
}
}
return ri.Digest < rj.Digest
return false
})
for i, l := range sortedRecords {
l.newIndex = i