This commit is contained in:
truewhile
2026-08-26 11:37:58 +08:00
parent ad6d0ba21d
commit 13c9035b76
+9 -1
View File
@@ -441,10 +441,18 @@ func (st *strmSyncState) walk115Flat(open115 *cloud115.OpenClient) error {
st.s.log.Warn("delete strm dir cache failed", zap.Error(err)) st.s.log.Warn("delete strm dir cache failed", zap.Error(err))
} }
} else { } else {
// 增量同步:预加载历史目录缓存 // 增量同步:预加载历史目录缓存(过滤历史一对多塌陷冲突的脏数据以自愈刷新)
cached, err := st.s.repo.StrmDirCache.ListBySyncPathID(ctx, st.p.ID) cached, err := st.s.repo.StrmDirCache.ListBySyncPathID(ctx, st.p.ID)
if err == nil { if err == nil {
pathCounts := make(map[string]int, len(cached))
for _, item := range cached { for _, item := range cached {
pathCounts[item.Path]++
}
for _, item := range cached {
// 若同一个 path 对应了多个不同 dir_id,说明包含历史层级塌陷的脏数据,不预加载,让后续步骤重新向 115 获取精确路径
if pathCounts[item.Path] > 1 {
continue
}
st.dirCache.Store(item.DirID, item.Path) st.dirCache.Store(item.DirID, item.Path)
} }
} }