🎨 Improve block reference count refreshing https://github.com/siyuan-note/siyuan/issues/14109

This commit is contained in:
Daniel 2025-02-16 11:21:14 +08:00
parent f0db9e54e7
commit abf14cc633
No known key found for this signature in database
GPG Key ID: 86211BA83DF03017
4 changed files with 10 additions and 10 deletions

View File

@ -1601,7 +1601,7 @@ func removeDoc0(tree *parse.Tree, childrenDir string) {
if nil != defTree {
defNode := treenode.GetNodeInTree(defTree, defID)
if nil != defNode {
task.AppendAsyncTaskWithDelay(task.SetDefRefCount, 1*time.Second, refreshRefCount, defTree.ID, defNode.ID)
task.AppendAsyncTaskWithDelay(task.SetDefRefCount, util.SQLFlushInterval, refreshRefCount, defTree.ID, defNode.ID)
}
}
}

View File

@ -330,7 +330,7 @@ func RollbackDocHistory(boxID, historyPath string) (err error) {
if nil != defTree {
defNode := treenode.GetNodeInTree(defTree, defID)
if nil != defNode {
task.AppendAsyncTaskWithDelay(task.SetDefRefCount, 1*time.Second, refreshRefCount, defTree.ID, defNode.ID)
task.AppendAsyncTaskWithDelay(task.SetDefRefCount, util.SQLFlushInterval, refreshRefCount, defTree.ID, defNode.ID)
}
}
}

View File

@ -381,8 +381,8 @@ func (tx *Transaction) doMove(operation *Operation) (ret *TxErr) {
if err = tx.writeTree(targetTree); err != nil {
return
}
task.AppendAsyncTaskWithDelay(task.SetDefRefCount, 1*time.Second, refreshRefCount, srcTree.ID, srcTree.ID)
task.AppendAsyncTaskWithDelay(task.SetDefRefCount, 1*time.Second, refreshRefCount, targetTree.ID, srcNode.ID)
task.AppendAsyncTaskWithDelay(task.SetDefRefCount, util.SQLFlushInterval, refreshRefCount, srcTree.ID, srcTree.ID)
task.AppendAsyncTaskWithDelay(task.SetDefRefCount, util.SQLFlushInterval, refreshRefCount, targetTree.ID, srcNode.ID)
}
return
}
@ -466,8 +466,8 @@ func (tx *Transaction) doMove(operation *Operation) (ret *TxErr) {
if err = tx.writeTree(targetTree); err != nil {
return &TxErr{code: TxErrCodeWriteTree, msg: err.Error(), id: id}
}
task.AppendAsyncTaskWithDelay(task.SetDefRefCount, 1*time.Second, refreshRefCount, srcTree.ID, srcTree.ID)
task.AppendAsyncTaskWithDelay(task.SetDefRefCount, 1*time.Second, refreshRefCount, targetTree.ID, srcNode.ID)
task.AppendAsyncTaskWithDelay(task.SetDefRefCount, util.SQLFlushInterval, refreshRefCount, srcTree.ID, srcTree.ID)
task.AppendAsyncTaskWithDelay(task.SetDefRefCount, util.SQLFlushInterval, refreshRefCount, targetTree.ID, srcNode.ID)
}
return
}
@ -779,7 +779,7 @@ func (tx *Transaction) doDelete(operation *Operation) (ret *TxErr) {
if nil != defTree {
defNode := treenode.GetNodeInTree(defTree, defID)
if nil != defNode {
task.AppendAsyncTaskWithDelay(task.SetDefRefCount, 1*time.Second, refreshRefCount, defTree.ID, defNode.ID)
task.AppendAsyncTaskWithDelay(task.SetDefRefCount, util.SQLFlushInterval, refreshRefCount, defTree.ID, defNode.ID)
}
}
}
@ -1110,7 +1110,7 @@ func (tx *Transaction) doInsert(operation *Operation) (ret *TxErr) {
if nil != defTree {
defNode := treenode.GetNodeInTree(defTree, defID)
if nil != defNode {
task.AppendAsyncTaskWithDelay(task.SetDefRefCount, 1*time.Second, refreshRefCount, defTree.ID, defNode.ID)
task.AppendAsyncTaskWithDelay(task.SetDefRefCount, util.SQLFlushInterval, refreshRefCount, defTree.ID, defNode.ID)
}
}
}
@ -1221,7 +1221,7 @@ func (tx *Transaction) doUpdate(operation *Operation) (ret *TxErr) {
if nil != defTree {
defNode := treenode.GetNodeInTree(defTree, defID)
if nil != defNode {
task.AppendAsyncTaskWithDelay(task.SetDefRefCount, 1*time.Second, refreshRefCount, defTree.ID, defNode.ID)
task.AppendAsyncTaskWithDelay(task.SetDefRefCount, util.SQLFlushInterval, refreshRefCount, defTree.ID, defNode.ID)
}
}
}

View File

@ -179,7 +179,7 @@ func StatusJob() {
queueLock.Lock()
for _, task := range taskQueue {
action := task.Action
if c := count[action]; 2 < c {
if c := count[action]; 7 < c {
logging.LogWarnf("too many tasks [%s], ignore show its status", action)
continue
}