used reverse.sort interface
This commit is contained in:
parent
c2e521e518
commit
57fc14d2f4
|
@ -102,13 +102,12 @@ func (store *LimitedStore) ensureSpace(size int64) error {
|
||||||
sorted_uploads[i] = Pair{u, h}
|
sorted_uploads[i] = Pair{u, h}
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
sort.Sort(sorted_uploads)
|
sort.Sort(sort.Reverse(sorted_uploads))
|
||||||
|
|
||||||
// Reverse traversal through the
|
// Forward traversal through the
|
||||||
// uploads in terms of size, biggest upload first
|
// uploads in terms of size, biggest upload first
|
||||||
j := len(store.uploads)-1
|
for _,k := sorted_uploads {
|
||||||
for j >= 0 {
|
id := k.key
|
||||||
id := sorted_uploads[j].key
|
|
||||||
if err := store.terminate(id); err != nil {
|
if err := store.terminate(id); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue