used reverse.sort interface

This commit is contained in:
anirudt 2015-11-25 07:47:31 +05:30
parent c2e521e518
commit 57fc14d2f4
1 changed files with 4 additions and 5 deletions

View File

@ -102,13 +102,12 @@ func (store *LimitedStore) ensureSpace(size int64) error {
sorted_uploads[i] = Pair{u, h}
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
j := len(store.uploads)-1
for j >= 0 {
id := sorted_uploads[j].key
for _,k := sorted_uploads {
id := k.key
if err := store.terminate(id); err != nil {
return err
}