mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 Improve boot index checking https://github.com/siyuan-note/siyuan/issues/11842
This commit is contained in:
parent
c9d3a50fd4
commit
ed5c4738f9
5 changed files with 38 additions and 22 deletions
|
|
@ -164,6 +164,8 @@ func FlushQueue() {
|
|||
|
||||
// Push database index commit event https://github.com/siyuan-note/siyuan/issues/8814
|
||||
util.BroadcastByType("main", "databaseIndexCommit", 0, "", nil)
|
||||
|
||||
eventbus.Publish(eventbus.EvtSQLIndexFlushed)
|
||||
}
|
||||
|
||||
func execOp(op *dbQueueOperation, tx *sql.Tx, context map[string]interface{}) (err error) {
|
||||
|
|
@ -219,7 +221,7 @@ func IndexNodeQueue(id string) {
|
|||
return
|
||||
}
|
||||
}
|
||||
operationQueue = append(operationQueue, newOp)
|
||||
appendOperation(newOp)
|
||||
}
|
||||
|
||||
func BatchRemoveAssetsQueue(hashes []string) {
|
||||
|
|
@ -231,7 +233,7 @@ func BatchRemoveAssetsQueue(hashes []string) {
|
|||
defer dbQueueLock.Unlock()
|
||||
|
||||
newOp := &dbQueueOperation{removeAssetHashes: hashes, inQueueTime: time.Now(), action: "delete_assets"}
|
||||
operationQueue = append(operationQueue, newOp)
|
||||
appendOperation(newOp)
|
||||
}
|
||||
|
||||
func UpdateBlockContentQueue(block *Block) {
|
||||
|
|
@ -245,7 +247,7 @@ func UpdateBlockContentQueue(block *Block) {
|
|||
return
|
||||
}
|
||||
}
|
||||
operationQueue = append(operationQueue, newOp)
|
||||
appendOperation(newOp)
|
||||
}
|
||||
|
||||
func DeleteRefsTreeQueue(tree *parse.Tree) {
|
||||
|
|
@ -259,7 +261,7 @@ func DeleteRefsTreeQueue(tree *parse.Tree) {
|
|||
return
|
||||
}
|
||||
}
|
||||
operationQueue = append(operationQueue, newOp)
|
||||
appendOperation(newOp)
|
||||
}
|
||||
|
||||
func UpdateRefsTreeQueue(tree *parse.Tree) {
|
||||
|
|
@ -273,7 +275,7 @@ func UpdateRefsTreeQueue(tree *parse.Tree) {
|
|||
return
|
||||
}
|
||||
}
|
||||
operationQueue = append(operationQueue, newOp)
|
||||
appendOperation(newOp)
|
||||
}
|
||||
|
||||
func DeleteBoxRefsQueue(boxID string) {
|
||||
|
|
@ -287,7 +289,7 @@ func DeleteBoxRefsQueue(boxID string) {
|
|||
return
|
||||
}
|
||||
}
|
||||
operationQueue = append(operationQueue, newOp)
|
||||
appendOperation(newOp)
|
||||
}
|
||||
|
||||
func DeleteBoxQueue(boxID string) {
|
||||
|
|
@ -301,7 +303,7 @@ func DeleteBoxQueue(boxID string) {
|
|||
return
|
||||
}
|
||||
}
|
||||
operationQueue = append(operationQueue, newOp)
|
||||
appendOperation(newOp)
|
||||
}
|
||||
|
||||
func IndexTreeQueue(tree *parse.Tree) {
|
||||
|
|
@ -315,7 +317,7 @@ func IndexTreeQueue(tree *parse.Tree) {
|
|||
return
|
||||
}
|
||||
}
|
||||
operationQueue = append(operationQueue, newOp)
|
||||
appendOperation(newOp)
|
||||
}
|
||||
|
||||
func UpsertTreeQueue(tree *parse.Tree) {
|
||||
|
|
@ -329,7 +331,7 @@ func UpsertTreeQueue(tree *parse.Tree) {
|
|||
return
|
||||
}
|
||||
}
|
||||
operationQueue = append(operationQueue, newOp)
|
||||
appendOperation(newOp)
|
||||
}
|
||||
|
||||
func RenameTreeQueue(tree *parse.Tree) {
|
||||
|
|
@ -347,7 +349,7 @@ func RenameTreeQueue(tree *parse.Tree) {
|
|||
return
|
||||
}
|
||||
}
|
||||
operationQueue = append(operationQueue, newOp)
|
||||
appendOperation(newOp)
|
||||
}
|
||||
|
||||
func RenameSubTreeQueue(tree *parse.Tree) {
|
||||
|
|
@ -365,7 +367,7 @@ func RenameSubTreeQueue(tree *parse.Tree) {
|
|||
return
|
||||
}
|
||||
}
|
||||
operationQueue = append(operationQueue, newOp)
|
||||
appendOperation(newOp)
|
||||
}
|
||||
|
||||
func RemoveTreeQueue(rootID string) {
|
||||
|
|
@ -379,7 +381,7 @@ func RemoveTreeQueue(rootID string) {
|
|||
return
|
||||
}
|
||||
}
|
||||
operationQueue = append(operationQueue, newOp)
|
||||
appendOperation(newOp)
|
||||
}
|
||||
|
||||
func BatchRemoveTreeQueue(rootIDs []string) {
|
||||
|
|
@ -391,7 +393,7 @@ func BatchRemoveTreeQueue(rootIDs []string) {
|
|||
defer dbQueueLock.Unlock()
|
||||
|
||||
newOp := &dbQueueOperation{removeTreeIDs: rootIDs, inQueueTime: time.Now(), action: "delete_ids"}
|
||||
operationQueue = append(operationQueue, newOp)
|
||||
appendOperation(newOp)
|
||||
}
|
||||
|
||||
func RemoveTreePathQueue(treeBox, treePathPrefix string) {
|
||||
|
|
@ -405,7 +407,7 @@ func RemoveTreePathQueue(treeBox, treePathPrefix string) {
|
|||
return
|
||||
}
|
||||
}
|
||||
operationQueue = append(operationQueue, newOp)
|
||||
appendOperation(newOp)
|
||||
}
|
||||
|
||||
func getOperations() (ops []*dbQueueOperation) {
|
||||
|
|
@ -416,3 +418,8 @@ func getOperations() (ops []*dbQueueOperation) {
|
|||
operationQueue = nil
|
||||
return
|
||||
}
|
||||
|
||||
func appendOperation(op *dbQueueOperation) {
|
||||
operationQueue = append(operationQueue, op)
|
||||
eventbus.Publish(eventbus.EvtSQLIndexChanged)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue