From bb41d70c107b739e9f58115a70139ac89cc14a2e Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 28 Mar 2024 22:35:05 -0400 Subject: [PATCH] fix: UploadExists check needs to be before UploadCompleted call --- protocols/s5/tus.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocols/s5/tus.go b/protocols/s5/tus.go index a069751..f8ee3e3 100644 --- a/protocols/s5/tus.go +++ b/protocols/s5/tus.go @@ -556,7 +556,6 @@ func (t *TusHandler) worker() { } mutex.(*sync.Mutex).Lock() - err = t.UploadCompleted(ctx, info.Upload.ID) exists, _ := t.UploadExists(ctx, decodedHash.HashBytes()) if !exists { mutex.(*sync.Mutex).Unlock() @@ -566,6 +565,7 @@ func (t *TusHandler) worker() { continue } mutex.(*sync.Mutex).Unlock() + err = t.UploadCompleted(ctx, info.Upload.ID) if err != nil { t.logger.Error("Could not complete tus upload", zap.Error(err)) continue