🎨 内核尚未完全启动的判断移到 API 层
This commit is contained in:
parent
23a30f0649
commit
15e2476126
2 changed files with 7 additions and 15 deletions
|
@ -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 {
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Add table
Reference in a new issue