🎨 If the data repo indexing time is greater than 7s, prompt user to purge the data repo https://github.com/siyuan-note/siyuan/issues/9613

This commit is contained in:
Daniel 2023-11-09 20:09:30 +08:00
parent 637706decd
commit 5d4015c458
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
6 changed files with 21 additions and 5 deletions

View file

@ -1445,6 +1445,8 @@ func needFullReindex(upsertTrees int) bool {
return 0.2 < float64(upsertTrees)/float64(treenode.CountTrees())
}
var promotedPurgeDataRepo bool
func indexRepoBeforeCloudSync(repo *dejavu.Repo) (err error) {
start := time.Now()
latest, _ := repo.Latest()
@ -1483,7 +1485,16 @@ func indexRepoBeforeCloudSync(repo *dejavu.Repo) (err error) {
}
if 7000 < elapsed.Milliseconds() {
// If the data repo indexing time is greater than 7s, prompt user to purge the data repo https://github.com/siyuan-note/siyuan/issues/9613
logging.LogWarnf("index data repo before cloud sync elapsed [%dms]", elapsed.Milliseconds())
if !promotedPurgeDataRepo {
go func() {
util.WaitForUILoaded()
time.Sleep(3 * time.Second)
util.PushMsg(Conf.language(218), 24000)
promotedPurgeDataRepo = true
}()
}
}
return
}