Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2023-01-25 23:01:32 +08:00
commit 7492913ddd
11 changed files with 57 additions and 50 deletions

View file

@ -901,7 +901,7 @@
"12": "Query asset failed [%s]",
"13": "Cannot create a file starting with .",
"14": "Export failed: %s",
"15": "The content block with ID [%s] was not found, please try again later in the document tree panel menu [Rebuild Index]",
"15": "Content block with id [%s] not found, please try again later",
"16": "Please enter the doc name",
"17": "The initial synchronization failed at startup. Unpredictable data overwriting may occur if you continue to operate. Please perform a synchronization first",
"18": "Get community user account failed",
@ -942,7 +942,7 @@
"53": "Data synchronization has not been enabled",
"54": "Indexing references...",
"55": "Indexed references of [%d] documents",
"56": "TODO",
"56": "Reindexing, please wait until rebuilding is complete before trying to open",
"57": "Failed to create temp key",
"58": "After the index is rebuilt, the interface will be automatically refreshed later...",
"59": "Failed to set sync ignore list",

View file

@ -901,7 +901,7 @@
"12": "Fallo en la consulta de activos [%s]",
"13": "No se puede crear un archivo que empiece por .",
"14": "Exportación fallida: %s",
"15": "El bloque de contenido con ID [%s] no se encontró, por favor inténtelo de nuevo más tarde en el menú del panel del árbol del documento [Reconstruir índice]",
"15": "No se encontró el bloque de contenido con id [%s], inténtelo de nuevo más tarde",
"16": "Por favor, introduzca el nombre del documento",
"17": "La sincronización inicial falló en el arranque. Puede producirse una sobreescritura de datos imprevisible si continúa operando. Por favor, realice primero una sincronización",
"18": "Falló la obtención de la cuenta de usuario de la comunidad",
@ -942,7 +942,7 @@
"53": "No se ha habilitado la sincronizacion de datos",
"54": "Indexando referencias...",
"55": "Referencias indexadas de [%d] documentos",
"56": "TODO",
"56": "Reindexando, espere hasta que se complete la reconstrucción antes de intentar abrir",
"57": "Fallo en la creación de la clave temporal",
"58": "Después de reconstruir el índice, la interfaz se actualizará automáticamente más tarde...",
"59": " Falló la configuración de sincronización de la lista de ignorados",

View file

@ -901,7 +901,7 @@
"12": "Échec de la requête asset [%s]",
"13": "Impossible de créer un fichier commençant par .",
"14": "L'exportation a échoué : %s",
"15": "Le bloc de contenu avec l'ID [%s] n'a pas été trouvé, veuillez réessayer plus tard dans le menu du panneau de l'arborescence du document [Reconstruire l'index]",
"15": "Bloc de contenu avec l'identifiant [%s] introuvable, veuillez réessayer plus tard",
"16": "Veuillez entrer le nom du fichier",
"17": "La synchronisation initiale a échoué au démarrage. Un écrasement imprévisible des données peut se produire si vous continuez à fonctionner. Veuillez d'abord effectuer une synchronisation.",
"18": "Échec de la récupération du compte utilisateur communautaire",
@ -942,7 +942,7 @@
"53": "La synchronisation des données n'a pas été activée",
"54": "Indexation des références...",
"55": "Références indexées de [%d] documents",
"56": "TODO",
"56": "Réindexation, veuillez attendre que la reconstruction soit terminée avant d'essayer d'ouvrir",
"57": "Échec de la création d'une clé temporaire",
"58": "Une fois l'index reconstruit, l'interface sera automatiquement rafraîchie ultérieurement...",
"59": "Échec de la définition de la liste des ignores de synchronisation",

View file

@ -901,7 +901,7 @@
"12": "查詢資料檔失敗 [%s]",
"13": "無法創建 . 開頭的文件",
"14": "匯出失敗:%s",
"15": "未找到 ID 為 [%s] 的內容塊,請在文檔樹面板菜單【重建索引】以後再試",
"15": "未找到 ID 為 [%s] 的內容塊,請後再試",
"16": "請輸入文檔名",
"17": "啟動時初次同步失敗,繼續操作可能會發生無法預測的數據覆蓋,請先執行一次同步",
"18": "獲取社區用戶帳號失敗",
@ -942,7 +942,7 @@
"53": "數據同步尚未啟用",
"54": "正在索引引用關係...",
"55": "已完成索引 [%d] 篇文檔的引用關係",
"56": "TODO",
"56": "正在重建索引,請等重建索引完畢後再嘗試打開",
"57": "創建臨時金鑰失敗",
"58": "重建索引完畢,稍後將自動重新整理介面...",
"59": "設置同步忽略列表失敗",
@ -1073,4 +1073,4 @@
"184": "由<a href=\"https://b3log.org/siyuan\" target=\"_blank\">思源筆記</a>強力驅動",
"185": "索引校驗完畢"
}
},
}

View file

@ -901,7 +901,7 @@
"12": "查询资源文件失败 [%s]",
"13": "无法创建 . 开头的文件",
"14": "导出失败:%s",
"15": "未找到 ID 为 [%s] 的内容块,请在文档树面板菜单 [重建索引] 以后再试",
"15": "未找到 ID 为 [%s] 的内容块,请后再试",
"16": "请输入文档名",
"17": "启动时初次同步失败,继续操作可能会发生无法预测的数据覆盖,请先执行一次同步",
"18": "获取社区用户账号失败",
@ -942,7 +942,7 @@
"53": "数据同步尚未启用",
"54": "正在索引引用关系...",
"55": "已完成索引 [%d] 篇文档的引用关系",
"56": "TODO",
"56": "正在重建索引,请等重建索引完毕后再尝试打开",
"57": "创建临时密钥失败",
"58": "重建索引完毕,稍后将自动刷新界面...",
"59": "设置同步忽略列表失败",

View file

@ -175,8 +175,8 @@ func checkBlockExist(c *gin.Context) {
return
}
if errors.Is(err, model.ErrIndexing) {
ret.Code = 3
ret.Data = id
ret.Code = 0
ret.Data = false
return
}
ret.Data = nil != b
@ -384,7 +384,7 @@ func getBlockInfo(c *gin.Context) {
}
if errors.Is(err, model.ErrIndexing) {
ret.Code = 3
ret.Data = id
ret.Msg = model.Conf.Language(56)
return
}
if nil == block {
@ -415,7 +415,7 @@ func getBlockInfo(c *gin.Context) {
}
if errors.Is(err, model.ErrIndexing) {
ret.Code = 3
ret.Data = id
ret.Data = model.Conf.Language(56)
return
}
rootTitle := root.IAL["title"]

View file

@ -19,11 +19,13 @@ package model
import (
"errors"
"fmt"
"time"
"github.com/88250/lute"
"github.com/88250/lute/ast"
"github.com/88250/lute/parse"
"github.com/siyuan-note/siyuan/kernel/sql"
"github.com/siyuan-note/siyuan/kernel/task"
"github.com/siyuan-note/siyuan/kernel/treenode"
"github.com/siyuan-note/siyuan/kernel/util"
)
@ -393,10 +395,16 @@ func getBlock(id string) (ret *Block, err error) {
tree, err := loadTreeByBlockID(id)
if nil != err {
if indexing {
if task.ContainIndexTask() {
err = ErrIndexing
return
}
time.Sleep(1 * time.Second)
tree, err = loadTreeByBlockID(id)
if nil != err {
return
}
return
}
node := treenode.GetNodeInTree(tree, id)

View file

@ -399,10 +399,12 @@ func Close(force bool, execInstallPkg int) (exitCode int) {
WaitForWritingFiles()
if !force {
syncData(false, true, false)
if 0 != ExitSyncSucc {
exitCode = 1
return
if Conf.Sync.Enabled && ((IsSubscriber() && conf.ProviderSiYuan == Conf.Sync.Provider) || conf.ProviderSiYuan != Conf.Sync.Provider) {
syncData(false, true, false)
if 0 != ExitSyncSucc {
exitCode = 1
return
}
}
}

View file

@ -52,25 +52,12 @@ func (box *Box) Index() {
task.AppendTask(task.DatabaseIndexRef, IndexRefs)
}
var indexing = false
func waitForIndexing() {
for indexing {
time.Sleep(time.Millisecond * 100)
}
}
func index(boxID string) {
box := Conf.Box(boxID)
if nil == box {
return
}
indexing = true
defer func() {
indexing = false
}()
util.SetBootDetails("Listing files...")
files := box.ListFiles("/")
boxLen := len(Conf.GetOpenedBoxes())

View file

@ -91,7 +91,6 @@ func BootSyncData() {
}
func SyncData(boot, exit, byHand bool) {
util.BroadcastByType("main", "syncing", 0, Conf.Language(81), nil)
syncData(boot, exit, byHand)
}
@ -161,10 +160,6 @@ func checkSync(boot, exit, byHand bool) bool {
return false
}
if !cloud.IsValidCloudDirName(Conf.Sync.CloudName) {
return false
}
if util.IsMutexLocked(&syncLock) {
logging.LogWarnf("sync is in progress")
planSyncAfter(30 * time.Second)

View file

@ -17,6 +17,7 @@
package task
import (
"context"
"github.com/siyuan-note/siyuan/kernel/util"
"reflect"
"sync"
@ -110,6 +111,15 @@ const (
DatabaseIndexEmbedBlock = "task.database.index.embedBlock" // 数据库索引嵌入块
)
func ContainIndexTask() bool {
for _, task := range taskQueue {
if DatabaseIndex == task.Action || DatabaseIndexFull == task.Action {
return true
}
}
return false
}
func StatusLoop() {
for {
time.Sleep(5 * time.Second)
@ -138,17 +148,12 @@ func StatusLoop() {
}
data["tasks"] = items
util.PushBackgroundTask(data)
if 0 < len(tasks) {
time.Sleep(5 * time.Second)
}
}
}
var taskWaitGroup = sync.WaitGroup{}
func Loop() {
for {
time.Sleep(10 * time.Millisecond)
time.Sleep(100 * time.Millisecond)
if QueueStatusClosing == taskQueueStatus {
clearQueue()
break
@ -163,9 +168,7 @@ func Loop() {
break
}
taskWaitGroup.Add(1)
go execTask(task)
taskWaitGroup.Wait()
execTask(task)
}
}
@ -201,6 +204,18 @@ func execTask(task *Task) {
}
}
task.Handler.Call(args)
taskWaitGroup.Done()
ctx, cancel := context.WithTimeout(context.Background(), time.Second*12)
defer cancel()
ch := make(chan bool, 1)
go func() {
task.Handler.Call(args)
ch <- true
}()
select {
case <-ctx.Done():
//logging.LogWarnf("task [%s] timeout", task.Action)
case <-ch:
//logging.LogInfof("task [%s] done", task.Action)
}
}