mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 10:00:13 +01:00
🎨 改进内核任务调度机制提升稳定性 https://github.com/siyuan-note/siyuan/issues/7113
This commit is contained in:
parent
e8fe3a77b3
commit
c5f4d3c780
19 changed files with 86 additions and 28 deletions
|
|
@ -864,6 +864,16 @@
|
||||||
"xy": "%d years %s",
|
"xy": "%d years %s",
|
||||||
"max": "a long while %s"
|
"max": "a long while %s"
|
||||||
},
|
},
|
||||||
|
"_taskAction": {
|
||||||
|
"task.repo.checkout": "Execute checkout from snapshot",
|
||||||
|
"task.database.index.full": "Execute rebuild index",
|
||||||
|
"task.database.index": "Execute database index queue",
|
||||||
|
"task.database.index.ref": "Execute database index reference",
|
||||||
|
"task.database.index.fix": "Execute database index fix",
|
||||||
|
"task.ocr.image": "Execute image OCR to extract text",
|
||||||
|
"task.history.generateDoc": "Execute GenerateDoc History",
|
||||||
|
"task.database.index.embedBlock": "Execute database index embed block"
|
||||||
|
},
|
||||||
"_trayMenu": {
|
"_trayMenu": {
|
||||||
"showWindow": "Show Window",
|
"showWindow": "Show Window",
|
||||||
"hideWindow": "Hide Window",
|
"hideWindow": "Hide Window",
|
||||||
|
|
|
||||||
|
|
@ -864,6 +864,16 @@
|
||||||
"xy": "%d años %s",
|
"xy": "%d años %s",
|
||||||
"max": "mucho tiempo %s"
|
"max": "mucho tiempo %s"
|
||||||
},
|
},
|
||||||
|
"_taskAction": {
|
||||||
|
"task.repo.checkout": "Realizar el pago desde la instantánea",
|
||||||
|
"task.database.index.full": "Ejecutar índice de reconstrucción",
|
||||||
|
"task.database.index": "Ejecutar cola de índice de base de datos",
|
||||||
|
"task.database.index.ref": "Ejecutar referencia de índice de base de datos",
|
||||||
|
"task.database.index.fix": "Realizar corrección del índice de la base de datos",
|
||||||
|
"task.ocr.image": "Ejecutar OCR de imagen para extraer texto",
|
||||||
|
"task.history.generateDoc": "Ejecutar Historial GenerateDoc",
|
||||||
|
"task.database.index.embedBlock": "Ejecutar bloque de incrustación de índice de base de datos"
|
||||||
|
},
|
||||||
"_trayMenu": {
|
"_trayMenu": {
|
||||||
"showWindow": "Mostrar ventana",
|
"showWindow": "Mostrar ventana",
|
||||||
"hideWindow": "Ocultar ventana",
|
"hideWindow": "Ocultar ventana",
|
||||||
|
|
|
||||||
|
|
@ -864,6 +864,16 @@
|
||||||
"xy": "%d ans %s",
|
"xy": "%d ans %s",
|
||||||
"max": "un bon moment %s"
|
"max": "un bon moment %s"
|
||||||
},
|
},
|
||||||
|
"_taskAction": {
|
||||||
|
"task.repo.checkout": "Effectuer le paiement à partir d'un instantané",
|
||||||
|
"task.database.index.full": "Exécuter l'index de reconstruction",
|
||||||
|
"task.database.index": "Exécuter la file d'attente d'index de la base de données",
|
||||||
|
"task.database.index.ref": "Exécuter la référence d'index de la base de données",
|
||||||
|
"task.database.index.fix": "Effectuer la correction de l'index de la base de données",
|
||||||
|
"task.ocr.image": "Exécute l'OCR d'image pour extraire le texte",
|
||||||
|
"task.history.generateDoc": "Exécuter l'historique de GenerateDoc",
|
||||||
|
"task.database.index.embedBlock": "Exécuter le bloc d'intégration d'index de base de données"
|
||||||
|
},
|
||||||
"_trayMenu": {
|
"_trayMenu": {
|
||||||
"showWindow": "Afficher la fenêtre principale",
|
"showWindow": "Afficher la fenêtre principale",
|
||||||
"hideWindow": "Masquer la fenêtre principale",
|
"hideWindow": "Masquer la fenêtre principale",
|
||||||
|
|
|
||||||
|
|
@ -864,6 +864,16 @@
|
||||||
"xy": "%d 年%s",
|
"xy": "%d 年%s",
|
||||||
"max": "很久%s"
|
"max": "很久%s"
|
||||||
},
|
},
|
||||||
|
"_taskAction": {
|
||||||
|
"task.repo.checkout": "執行從快照中檢出",
|
||||||
|
"task.database.index.full": "執行重建索引",
|
||||||
|
"task.database.index": "執行數據庫索引隊列",
|
||||||
|
"task.database.index.ref": "執行數據庫索引引用",
|
||||||
|
"task.database.index.fix": "執行數據庫索引訂正",
|
||||||
|
"task.ocr.image": "執行圖片 OCR 提取文本",
|
||||||
|
"task.history.generateDoc": "執行生成文件歷史",
|
||||||
|
"task.database.index.embedBlock": "執行數據庫索引嵌入塊"
|
||||||
|
},
|
||||||
"_trayMenu": {
|
"_trayMenu": {
|
||||||
"showWindow": "顯示主窗口",
|
"showWindow": "顯示主窗口",
|
||||||
"hideWindow": "隱藏主窗口",
|
"hideWindow": "隱藏主窗口",
|
||||||
|
|
@ -1062,4 +1072,4 @@
|
||||||
"184": "由<a href=\"https://b3log.org/siyuan\" target=\"_blank\">思源筆記</a>強力驅動",
|
"184": "由<a href=\"https://b3log.org/siyuan\" target=\"_blank\">思源筆記</a>強力驅動",
|
||||||
"185": "索引校驗完畢"
|
"185": "索引校驗完畢"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
|
||||||
|
|
@ -864,6 +864,16 @@
|
||||||
"xy": "%d 年%s",
|
"xy": "%d 年%s",
|
||||||
"max": "很久%s"
|
"max": "很久%s"
|
||||||
},
|
},
|
||||||
|
"_taskAction": {
|
||||||
|
"task.repo.checkout": "执行从快照中检出",
|
||||||
|
"task.database.index.full": "执行重建索引",
|
||||||
|
"task.database.index": "执行数据库索引队列",
|
||||||
|
"task.database.index.ref": "执行数据库索引引用",
|
||||||
|
"task.database.index.fix": "执行数据库索引订正",
|
||||||
|
"task.ocr.image": "执行图片 OCR 提取文本",
|
||||||
|
"task.history.generateDoc": "执行生成文件历史",
|
||||||
|
"task.database.index.embedBlock": "执行数据库索引嵌入块"
|
||||||
|
},
|
||||||
"_trayMenu": {
|
"_trayMenu": {
|
||||||
"showWindow": "显示主窗口",
|
"showWindow": "显示主窗口",
|
||||||
"hideWindow": "隐藏主窗口",
|
"hideWindow": "隐藏主窗口",
|
||||||
|
|
|
||||||
|
|
@ -271,6 +271,7 @@ func setAppearance(c *gin.Context) {
|
||||||
|
|
||||||
model.Conf.Appearance = appearance
|
model.Conf.Appearance = appearance
|
||||||
model.Conf.Lang = appearance.Lang
|
model.Conf.Lang = appearance.Lang
|
||||||
|
util.Lang = model.Conf.Lang
|
||||||
model.Conf.Save()
|
model.Conf.Save()
|
||||||
model.InitAppearance()
|
model.InitAppearance()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ package mobile
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/siyuan-note/siyuan/kernel/task"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
@ -27,7 +28,6 @@ import (
|
||||||
"github.com/siyuan-note/siyuan/kernel/model"
|
"github.com/siyuan-note/siyuan/kernel/model"
|
||||||
"github.com/siyuan-note/siyuan/kernel/server"
|
"github.com/siyuan-note/siyuan/kernel/server"
|
||||||
"github.com/siyuan-note/siyuan/kernel/sql"
|
"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/treenode"
|
||||||
"github.com/siyuan-note/siyuan/kernel/util"
|
"github.com/siyuan-note/siyuan/kernel/util"
|
||||||
_ "golang.org/x/mobile/bind"
|
_ "golang.org/x/mobile/bind"
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/siyuan-note/siyuan/kernel/task"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
|
@ -39,7 +40,6 @@ import (
|
||||||
"github.com/siyuan-note/logging"
|
"github.com/siyuan-note/logging"
|
||||||
"github.com/siyuan-note/siyuan/kernel/conf"
|
"github.com/siyuan-note/siyuan/kernel/conf"
|
||||||
"github.com/siyuan-note/siyuan/kernel/sql"
|
"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/treenode"
|
||||||
"github.com/siyuan-note/siyuan/kernel/util"
|
"github.com/siyuan-note/siyuan/kernel/util"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ func InitConf() {
|
||||||
|
|
||||||
if userLang, err := locale.Detect(); nil == err {
|
if userLang, err := locale.Detect(); nil == err {
|
||||||
var supportLangs []language.Tag
|
var supportLangs []language.Tag
|
||||||
for lang := range langs {
|
for lang := range util.Langs {
|
||||||
if tag, err := language.Parse(lang); nil == err {
|
if tag, err := language.Parse(lang); nil == err {
|
||||||
supportLangs = append(supportLangs, tag)
|
supportLangs = append(supportLangs, tag)
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -125,6 +125,7 @@ func InitConf() {
|
||||||
Conf.Lang = util.Lang
|
Conf.Lang = util.Lang
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
util.Lang = Conf.Lang
|
||||||
}
|
}
|
||||||
|
|
||||||
Conf.Langs = loadLangs()
|
Conf.Langs = loadLangs()
|
||||||
|
|
@ -140,6 +141,7 @@ func InitConf() {
|
||||||
}
|
}
|
||||||
if !langOK {
|
if !langOK {
|
||||||
Conf.Lang = "en_US"
|
Conf.Lang = "en_US"
|
||||||
|
util.Lang = Conf.Lang
|
||||||
}
|
}
|
||||||
Conf.Appearance.Lang = Conf.Lang
|
Conf.Appearance.Lang = Conf.Lang
|
||||||
if nil == Conf.UILayout {
|
if nil == Conf.UILayout {
|
||||||
|
|
@ -321,9 +323,6 @@ func InitConf() {
|
||||||
util.SetNetworkProxy(Conf.System.NetworkProxy.String())
|
util.SetNetworkProxy(Conf.System.NetworkProxy.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
var langs = map[string]map[int]string{}
|
|
||||||
var timeLangs = map[string]map[string]interface{}{}
|
|
||||||
|
|
||||||
func initLang() {
|
func initLang() {
|
||||||
p := filepath.Join(util.WorkingDir, "appearance", "langs")
|
p := filepath.Join(util.WorkingDir, "appearance", "langs")
|
||||||
dir, err := os.Open(p)
|
dir, err := os.Open(p)
|
||||||
|
|
@ -363,14 +362,15 @@ func initLang() {
|
||||||
}
|
}
|
||||||
kernelMap[-1] = label
|
kernelMap[-1] = label
|
||||||
name := langName[:strings.LastIndex(langName, ".")]
|
name := langName[:strings.LastIndex(langName, ".")]
|
||||||
langs[name] = kernelMap
|
util.Langs[name] = kernelMap
|
||||||
|
|
||||||
timeLangs[name] = langMap["_time"].(map[string]interface{})
|
util.TimeLangs[name] = langMap["_time"].(map[string]interface{})
|
||||||
|
util.TaskActionLangs[name] = langMap["_taskAction"].(map[string]interface{})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadLangs() (ret []*conf.Lang) {
|
func loadLangs() (ret []*conf.Lang) {
|
||||||
for name, langMap := range langs {
|
for name, langMap := range util.Langs {
|
||||||
lang := &conf.Lang{Label: langMap[-1], Name: name}
|
lang := &conf.Lang{Label: langMap[-1], Name: name}
|
||||||
ret = append(ret, lang)
|
ret = append(ret, lang)
|
||||||
}
|
}
|
||||||
|
|
@ -567,11 +567,11 @@ func (conf *AppConf) GetClosedBoxes() (ret []*Box) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (conf *AppConf) Language(num int) (ret string) {
|
func (conf *AppConf) Language(num int) (ret string) {
|
||||||
ret = langs[conf.Lang][num]
|
ret = util.Langs[conf.Lang][num]
|
||||||
if "" != ret {
|
if "" != ret {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ret = langs["en_US"][num]
|
ret = util.Langs["en_US"][num]
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ package model
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/siyuan-note/siyuan/kernel/task"
|
||||||
"math"
|
"math"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
|
@ -43,7 +44,6 @@ import (
|
||||||
"github.com/siyuan-note/siyuan/kernel/filesys"
|
"github.com/siyuan-note/siyuan/kernel/filesys"
|
||||||
"github.com/siyuan-note/siyuan/kernel/search"
|
"github.com/siyuan-note/siyuan/kernel/search"
|
||||||
"github.com/siyuan-note/siyuan/kernel/sql"
|
"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/treenode"
|
||||||
"github.com/siyuan-note/siyuan/kernel/util"
|
"github.com/siyuan-note/siyuan/kernel/util"
|
||||||
)
|
)
|
||||||
|
|
@ -97,7 +97,7 @@ func (box *Box) docFromFileInfo(fileInfo *FileInfo, ial map[string]string) (ret
|
||||||
}
|
}
|
||||||
|
|
||||||
func HumanizeTime(then time.Time) string {
|
func HumanizeTime(then time.Time) string {
|
||||||
labels := timeLangs[Conf.Lang]
|
labels := util.TimeLangs[Conf.Lang]
|
||||||
|
|
||||||
defaultMagnitudes := []humanize.RelTimeMagnitude{
|
defaultMagnitudes := []humanize.RelTimeMagnitude{
|
||||||
{time.Second, labels["now"].(string), time.Second},
|
{time.Second, labels["now"].(string), time.Second},
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ package model
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/siyuan-note/siyuan/kernel/task"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"math"
|
"math"
|
||||||
"os"
|
"os"
|
||||||
|
|
@ -38,7 +39,6 @@ import (
|
||||||
"github.com/siyuan-note/siyuan/kernel/conf"
|
"github.com/siyuan-note/siyuan/kernel/conf"
|
||||||
"github.com/siyuan-note/siyuan/kernel/search"
|
"github.com/siyuan-note/siyuan/kernel/search"
|
||||||
"github.com/siyuan-note/siyuan/kernel/sql"
|
"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/treenode"
|
||||||
"github.com/siyuan-note/siyuan/kernel/util"
|
"github.com/siyuan-note/siyuan/kernel/util"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/siyuan-note/siyuan/kernel/task"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|
@ -29,7 +30,6 @@ import (
|
||||||
"github.com/siyuan-note/siyuan/kernel/cache"
|
"github.com/siyuan-note/siyuan/kernel/cache"
|
||||||
"github.com/siyuan-note/siyuan/kernel/filesys"
|
"github.com/siyuan-note/siyuan/kernel/filesys"
|
||||||
"github.com/siyuan-note/siyuan/kernel/sql"
|
"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/treenode"
|
||||||
"github.com/siyuan-note/siyuan/kernel/util"
|
"github.com/siyuan-note/siyuan/kernel/util"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/siyuan-note/siyuan/kernel/task"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
@ -15,7 +16,6 @@ import (
|
||||||
"github.com/panjf2000/ants/v2"
|
"github.com/panjf2000/ants/v2"
|
||||||
"github.com/siyuan-note/logging"
|
"github.com/siyuan-note/logging"
|
||||||
"github.com/siyuan-note/siyuan/kernel/cache"
|
"github.com/siyuan-note/siyuan/kernel/cache"
|
||||||
"github.com/siyuan-note/siyuan/kernel/task"
|
|
||||||
"github.com/siyuan-note/siyuan/kernel/util"
|
"github.com/siyuan-note/siyuan/kernel/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/siyuan-note/siyuan/kernel/task"
|
||||||
"math"
|
"math"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
@ -49,7 +50,6 @@ import (
|
||||||
"github.com/siyuan-note/siyuan/kernel/cache"
|
"github.com/siyuan-note/siyuan/kernel/cache"
|
||||||
"github.com/siyuan-note/siyuan/kernel/conf"
|
"github.com/siyuan-note/siyuan/kernel/conf"
|
||||||
"github.com/siyuan-note/siyuan/kernel/sql"
|
"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/treenode"
|
||||||
"github.com/siyuan-note/siyuan/kernel/util"
|
"github.com/siyuan-note/siyuan/kernel/util"
|
||||||
"github.com/studio-b12/gowebdav"
|
"github.com/studio-b12/gowebdav"
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/siyuan-note/siyuan/kernel/task"
|
||||||
"path"
|
"path"
|
||||||
"regexp"
|
"regexp"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
@ -38,7 +39,6 @@ import (
|
||||||
"github.com/siyuan-note/siyuan/kernel/conf"
|
"github.com/siyuan-note/siyuan/kernel/conf"
|
||||||
"github.com/siyuan-note/siyuan/kernel/search"
|
"github.com/siyuan-note/siyuan/kernel/search"
|
||||||
"github.com/siyuan-note/siyuan/kernel/sql"
|
"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/treenode"
|
||||||
"github.com/siyuan-note/siyuan/kernel/util"
|
"github.com/siyuan-note/siyuan/kernel/util"
|
||||||
"github.com/xrash/smetrics"
|
"github.com/xrash/smetrics"
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ import (
|
||||||
"github.com/siyuan-note/logging"
|
"github.com/siyuan-note/logging"
|
||||||
"github.com/siyuan-note/siyuan/kernel/conf"
|
"github.com/siyuan-note/siyuan/kernel/conf"
|
||||||
"github.com/siyuan-note/siyuan/kernel/sql"
|
"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/treenode"
|
||||||
"github.com/siyuan-note/siyuan/kernel/util"
|
"github.com/siyuan-note/siyuan/kernel/util"
|
||||||
)
|
)
|
||||||
|
|
@ -92,12 +91,8 @@ func BootSyncData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func SyncData(boot, exit, byHand bool) {
|
func SyncData(boot, exit, byHand bool) {
|
||||||
if !checkSync(boot, exit, byHand) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
util.BroadcastByType("main", "syncing", 0, Conf.Language(81), nil)
|
util.BroadcastByType("main", "syncing", 0, Conf.Language(81), nil)
|
||||||
task.PrependTask(task.CloudSync, syncData, boot, exit, byHand)
|
syncData(boot, exit, byHand)
|
||||||
}
|
}
|
||||||
|
|
||||||
func syncData(boot, exit, byHand bool) {
|
func syncData(boot, exit, byHand bool) {
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/siyuan-note/siyuan/kernel/task"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
@ -38,7 +39,6 @@ import (
|
||||||
"github.com/siyuan-note/logging"
|
"github.com/siyuan-note/logging"
|
||||||
"github.com/siyuan-note/siyuan/kernel/cache"
|
"github.com/siyuan-note/siyuan/kernel/cache"
|
||||||
"github.com/siyuan-note/siyuan/kernel/sql"
|
"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/treenode"
|
||||||
"github.com/siyuan-note/siyuan/kernel/util"
|
"github.com/siyuan-note/siyuan/kernel/util"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,6 @@ func newTask(action string, handler interface{}, args ...interface{}) *Task {
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
CloudSync = "task.cloud.sync" // 数据同步
|
|
||||||
RepoCheckout = "task.repo.checkout" // 从快照中检出
|
RepoCheckout = "task.repo.checkout" // 从快照中检出
|
||||||
DatabaseIndexFull = "task.database.index.full" // 重建索引
|
DatabaseIndexFull = "task.database.index.full" // 重建索引
|
||||||
DatabaseIndex = "task.database.index" // 数据库索引队列
|
DatabaseIndex = "task.database.index" // 数据库索引队列
|
||||||
|
|
@ -120,8 +119,15 @@ func StatusLoop() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
actionLangs := util.TaskActionLangs[util.Lang]
|
||||||
|
action := task.Action
|
||||||
|
if nil != actionLangs {
|
||||||
|
if label := actionLangs[task.Action]; nil != label {
|
||||||
|
action = label.(string)
|
||||||
|
}
|
||||||
|
}
|
||||||
item := map[string]interface{}{
|
item := map[string]interface{}{
|
||||||
"action": task.Action,
|
"action": action,
|
||||||
}
|
}
|
||||||
items = append(items, item)
|
items = append(items, item)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,3 +104,9 @@ const (
|
||||||
// SQLFlushInterval 为数据库事务队列写入间隔。
|
// SQLFlushInterval 为数据库事务队列写入间隔。
|
||||||
SQLFlushInterval = 3000 * time.Millisecond
|
SQLFlushInterval = 3000 * time.Millisecond
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
Langs = map[string]map[int]string{}
|
||||||
|
TimeLangs = map[string]map[string]interface{}{}
|
||||||
|
TaskActionLangs = map[string]map[string]interface{}{}
|
||||||
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue