fix: UploadExists check needs to be before UploadCompleted call

This commit is contained in:
Derrick Hammer 2024-03-28 22:35:05 -04:00
parent 82532b01eb
commit bb41d70c10
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 1 additions and 1 deletions

View File

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