diff --git a/kernel/api/transaction.go b/kernel/api/transaction.go index 387110ef0..98e0b3151 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 3487d8e5b..54e182a8d 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()