mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-03 18:21:17 +08:00
🎨 Improve block reference count refreshing https://github.com/siyuan-note/siyuan/issues/14109
This commit is contained in:
parent
f0db9e54e7
commit
abf14cc633
@ -1601,7 +1601,7 @@ func removeDoc0(tree *parse.Tree, childrenDir string) {
|
|||||||
if nil != defTree {
|
if nil != defTree {
|
||||||
defNode := treenode.GetNodeInTree(defTree, defID)
|
defNode := treenode.GetNodeInTree(defTree, defID)
|
||||||
if nil != defNode {
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -330,7 +330,7 @@ func RollbackDocHistory(boxID, historyPath string) (err error) {
|
|||||||
if nil != defTree {
|
if nil != defTree {
|
||||||
defNode := treenode.GetNodeInTree(defTree, defID)
|
defNode := treenode.GetNodeInTree(defTree, defID)
|
||||||
if nil != defNode {
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -381,8 +381,8 @@ func (tx *Transaction) doMove(operation *Operation) (ret *TxErr) {
|
|||||||
if err = tx.writeTree(targetTree); err != nil {
|
if err = tx.writeTree(targetTree); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
task.AppendAsyncTaskWithDelay(task.SetDefRefCount, 1*time.Second, refreshRefCount, srcTree.ID, srcTree.ID)
|
task.AppendAsyncTaskWithDelay(task.SetDefRefCount, util.SQLFlushInterval, refreshRefCount, srcTree.ID, srcTree.ID)
|
||||||
task.AppendAsyncTaskWithDelay(task.SetDefRefCount, 1*time.Second, refreshRefCount, targetTree.ID, srcNode.ID)
|
task.AppendAsyncTaskWithDelay(task.SetDefRefCount, util.SQLFlushInterval, refreshRefCount, targetTree.ID, srcNode.ID)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -466,8 +466,8 @@ func (tx *Transaction) doMove(operation *Operation) (ret *TxErr) {
|
|||||||
if err = tx.writeTree(targetTree); err != nil {
|
if err = tx.writeTree(targetTree); err != nil {
|
||||||
return &TxErr{code: TxErrCodeWriteTree, msg: err.Error(), id: id}
|
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, util.SQLFlushInterval, refreshRefCount, srcTree.ID, srcTree.ID)
|
||||||
task.AppendAsyncTaskWithDelay(task.SetDefRefCount, 1*time.Second, refreshRefCount, targetTree.ID, srcNode.ID)
|
task.AppendAsyncTaskWithDelay(task.SetDefRefCount, util.SQLFlushInterval, refreshRefCount, targetTree.ID, srcNode.ID)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -779,7 +779,7 @@ func (tx *Transaction) doDelete(operation *Operation) (ret *TxErr) {
|
|||||||
if nil != defTree {
|
if nil != defTree {
|
||||||
defNode := treenode.GetNodeInTree(defTree, defID)
|
defNode := treenode.GetNodeInTree(defTree, defID)
|
||||||
if nil != defNode {
|
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 {
|
if nil != defTree {
|
||||||
defNode := treenode.GetNodeInTree(defTree, defID)
|
defNode := treenode.GetNodeInTree(defTree, defID)
|
||||||
if nil != defNode {
|
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 {
|
if nil != defTree {
|
||||||
defNode := treenode.GetNodeInTree(defTree, defID)
|
defNode := treenode.GetNodeInTree(defTree, defID)
|
||||||
if nil != defNode {
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ func StatusJob() {
|
|||||||
queueLock.Lock()
|
queueLock.Lock()
|
||||||
for _, task := range taskQueue {
|
for _, task := range taskQueue {
|
||||||
action := task.Action
|
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)
|
logging.LogWarnf("too many tasks [%s], ignore show its status", action)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user