handle local file discard error for sync

This commit is contained in:
xiaoyaofenfen 2022-08-19 11:53:23 +08:00
parent 7978788ccd
commit a8850e2479
3 changed files with 14 additions and 6 deletions

View File

@ -518,6 +518,10 @@ func (f *FileActionTaskManager) doFileDiffRoutine(panFiles PanFileList, localFil
err := fileSum.OpenPath()
if err != nil {
logger.Verbosef("文件不可读, 错误信息: %s, 跳过...\n", err)
if localFile.ScanStatus == ScanStatusDiscard {
// 文件已被删除,直接删除无用记录
f.task.localFileDb.Delete(localFile.Path)
}
continue
}
fileSum.Sum(localfile.CHECKSUM_SHA1) // block operation

View File

@ -24,12 +24,7 @@ func TestStart(t *testing.T) {
user.FileDriveId,
panClient,
"D:\\smb\\feny\\goprojects\\dev\\sync_drive",
1,
1,
int64(256*1024),
aliyunpan.DefaultChunkSize,
false,
0, 0,
SyncOption{},
)
manager.Start(nil)

View File

@ -3,6 +3,7 @@ package syncdrive
import (
"fmt"
"github.com/tickstep/aliyunpan-api/aliyunpan"
"sync"
"testing"
"time"
)
@ -37,3 +38,11 @@ func TestSyncTask(t *testing.T) {
time.Sleep(60 * time.Second)
task.Stop()
}
func TestSyncLocker(t *testing.T) {
locker := &sync.Mutex{}
locker.Lock()
fmt.Println("lock")
//locker.Unlock()
defer locker.Unlock()
}