🎨 Improve data synchronization to reduce the probability of conflicts https://github.com/siyuan-note/siyuan/issues/13065

This commit is contained in:
Daniel 2024-11-09 15:09:53 +08:00
parent a32ceb8e2f
commit 2da780a04e
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -645,6 +645,7 @@ func checkoutRepo(id string) {
// 回滚快照时默认为当前数据创建一个快照
// When rolling back a snapshot, a snapshot is created for the current data by default https://github.com/siyuan-note/siyuan/issues/12470
FlushTxQueue()
_, err = repo.Index("Backup before checkout", map[string]interface{}{eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBarAndProgress})
if err != nil {
logging.LogErrorf("index repository failed: %s", err)
@ -1627,7 +1628,9 @@ var promotedPurgeDataRepo bool
func indexRepoBeforeCloudSync(repo *dejavu.Repo) (beforeIndex, afterIndex *entity.Index, err error) {
start := time.Now()
beforeIndex, _ = repo.Latest()
FlushTxQueue()
afterIndex, err = repo.Index("[Sync] Cloud sync", map[string]interface{}{
eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBar,
})