Skip to content

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

:art: 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

Daniel5d4015c458be
diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json
index 9bafc6b8af..ae8440d735 100644
--- a/app/appearance/langs/en_US.json
+++ b/app/appearance/langs/en_US.json
@@ -1315,6 +1315,7 @@
"214": "This function needs to be signed in to use",
"215": "Save failed: The target file is being used by another program",
"216": "Rebuilding asset content data index, please wait...",
- "217": "[%d/%d] Created asset content data index"
+ "217": "[%d/%d] Created asset content data index",
+ "218": "Too many snapshots of the data repo have been detected, which slows down program startup and data sync. Please consider executing [Settings - About - Data repo purge]"
}
}
diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.json
index 7223eddae9..448138a0b0 100644
--- a/app/appearance/langs/es_ES.json
+++ b/app/appearance/langs/es_ES.json
@@ -1315,6 +1315,7 @@
"214": "Esta función requiere iniciar sesión en la cuenta antes de poder usarla",
"215": "Error al guardar: el archivo de destino está siendo utilizado por otro programa",
"216": "Reconstruyendo el índice de datos de contenido de recursos, espere...",
- "217": "[%d/%d] Índice de datos de contenido de activos creado"
+ "217": "[%d/%d] Índice de datos de contenido de activos creado",
+ "218": "Se han detectado demasiadas instantáneas del repositorio de datos, lo que ralentiza el inicio del programa y la sincronización de datos. Considere ejecutar [Configuración - Acerca de - Purga del repositorio de datos]"
}
}
diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json
index 25e766d64d..acdc4fd1ff 100644
--- a/app/appearance/langs/fr_FR.json
+++ b/app/appearance/langs/fr_FR.json
@@ -1315,6 +1315,7 @@
"214": "La fonctionnalité nécessite un numéro de compte de connexion avant de pouvoir être utilisée",
"215": "Échec de l'enregistrement : le fichier de destination est utilisé par un autre programme",
"216": "Reconstruction de l'index des données du contenu des ressources, veuillez patienter...",
- "217": "[%d/%d] Création d'un index de données de contenu d'actif"
+ "217": "[%d/%d] Création d'un index de données de contenu d'actif",
+ "218": "Trop d'instantanés du référentiel de données ont été détectés, ce qui ralentit le démarrage du programme et la synchronisation des données. Veuillez envisager d'exécuter [Paramètres - À propos - Purge du référentiel de données]"
}
}
diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json
index a54288e438..84c31c15ef 100644
--- a/app/appearance/langs/zh_CHT.json
+++ b/app/appearance/langs/zh_CHT.json
@@ -1315,6 +1315,7 @@
"214": "該功能需要登錄賬號後才能使用",
"215": "保存失敗:目標文件正在被其他程序佔用",
"216": "正在重建資源文件內容數據索引,請稍等...",
- "217": "[%d/%d] 已經創建資源文件內容數據索引"
+ "217": "[%d/%d] 已經創建資源文件內容數據索引",
+ "218": "偵測到資料倉儲快照過多,降低了程式啟動和資料同步速度,請考慮執行 [設定 - 關於 - 資料倉儲清理]"
}
}
diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json
index 24f5ffd45c..e6e8b91689 100644
--- a/app/appearance/langs/zh_CN.json
+++ b/app/appearance/langs/zh_CN.json
@@ -1315,6 +1315,7 @@
"214": "该功能需要登录账号后才能使用",
"215": "保存失败:目标文件并且正在被其他程序占用",
"216": "正在重建资源文件内容数据索引,请稍等...",
- "217": "[%d/%d] 已经创建资源文件内容数据索引"
+ "217": "[%d/%d] 已经创建资源文件内容数据索引",
+ "218": "检测到数据仓库快照过多,降低了程序启动和数据同步速度,请考虑执行 [设置 - 关于 - 数据仓库清理]"
}
}
diff --git a/kernel/model/repository.go b/kernel/model/repository.go
index c22e6bcb23..f46e1c82e3 100644
--- a/kernel/model/repository.go
+++ b/kernel/model/repository.go
@@ -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
}