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} 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
} }