limitedstore: Claim back space from already deleted uploads

Fixes https://github.com/tus/tusd/issues/249
This commit is contained in:
Acconut 2019-03-15 21:57:47 +01:00
parent 1612a8ca46
commit 0116e4e15b
1 changed files with 6 additions and 1 deletions

View File

@ -15,6 +15,8 @@
package limitedstore
import (
"fmt"
"os"
"sort"
"sync"
@ -91,7 +93,10 @@ func (store *LimitedStore) Terminate(id string) error {
func (store *LimitedStore) terminate(id string) error {
err := store.terminater.Terminate(id)
if err != nil {
// Ignore the error if the upload could not be found. In this case, the upload
// has likely already been removed by another service (e.g. a cron job) and we
// just remove the upload from our internal list and claim the used space back.
if err != nil && err != tusd.ErrNotFound && !os.IsNotExist(err) {
return err
}