Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: 优化云端同步上传资源占用和耗时 https://github.com/siyuan-note/siyuan/issues/5093

Liang Ding7f5ddc58380f
diff --git a/kernel/model/osssync.go b/kernel/model/osssync.go
index c83477cb2c..8393c5c15f 100644
--- a/kernel/model/osssync.go
+++ b/kernel/model/osssync.go
@@ -802,21 +802,22 @@ func localUpsertRemoveListOSS(localDirPath string, cloudFileList map[string]*Clo
return nil
}
- // TODO: 优化云端同步上传资源占用和耗时 https://github.com/siyuan-note/siyuan/issues/5093
+ if 0 < cloudIdx.Updated {
+ // 优先使用时间戳校验
+ if localModTime := info.ModTime().Unix(); cloudIdx.Updated == localModTime {
+ unchanged[relPath] = true
+ return nil
+ }
+ }
+
localHash, hashErr := util.GetEtag(path)
if nil != hashErr {
err = hashErr
return io.EOF
}
-
if cloudIdx.Hash == localHash {
unchanged[relPath] = true
}
-
- //localModTime := info.ModTime().Unix()
- //if cloudIdx.Updated == localModTime {
- // unchanged[relPath] = true
- //}
return nil
})