Skip to content

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

:art: 内核尚未完全启动的判断移到 API 层

Liang Ding15e24761266d
diff --git a/kernel/api/transaction.go b/kernel/api/transaction.go
index 387110ef07..98e0b31515 100644
--- a/kernel/api/transaction.go
+++ b/kernel/api/transaction.go
@@ -49,6 +49,13 @@ func performTransactions(c *gin.Context) {
return
}
+ if !util.IsBooted() {
+ ret.Code = -1
+ ret.Msg = fmt.Sprintf(model.Conf.Language(74), int(util.GetBootProgress()))
+ ret.Data = map[string]interface{}{"closeTimeout": 5000}
+ return
+ }
+
var transactions []*model.Transaction
if err = gulu.JSON.UnmarshalJSON(data, &transactions); nil != err {
ret.Code = -1
@@ -70,12 +77,6 @@ func performTransactions(c *gin.Context) {
ret.Code = 1
return
}
- if model.ErrNotFullyBoot == err {
- ret.Code = -1
- ret.Msg = fmt.Sprintf(model.Conf.Language(74), int(util.GetBootProgress()))
- ret.Data = map[string]interface{}{"closeTimeout": 5000}
- return
- }
if nil != err {
tx, txErr := sql.BeginTx()
if nil != txErr {
diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go
index 3487d8e5b3..54e182a8d7 100644
--- a/kernel/model/transaction.go
+++ b/kernel/model/transaction.go
@@ -40,10 +40,6 @@ import (
"github.com/siyuan-note/siyuan/kernel/util"
)
-var (
- ErrNotFullyBoot = errors.New("the kernel has not been fully booted, please try again later")
-)
-
var writingDataLock = sync.Mutex{}
func IsFoldHeading(transactions *[]*Transaction) bool {
@@ -171,11 +167,6 @@ func mergeTx() (ret *Transaction) {
}
func PerformTransactions(transactions *[]*Transaction) (err error) {
- if !util.IsBooted() {
- err = ErrNotFullyBoot
- return
- }
-
txQueueLock.Lock()
txQueue = append(txQueue, *transactions...)
txQueueLock.Unlock()