From 7bd973deca60b49bd5baea74570e9a7dd3d86b60 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Sun, 8 Jan 2023 23:23:17 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E8=87=AA=E5=8A=A8=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E7=B4=A2=E5=BC=95=20https://github.?= =?UTF-8?q?com/siyuan-note/siyuan/issues/7016?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/transaction.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go index 727ca49b4..26a88d569 100644 --- a/kernel/model/transaction.go +++ b/kernel/model/transaction.go @@ -1227,7 +1227,16 @@ func AutoFixIndex() { } } +var autoFixLock = sync.Mutex{} + func autoFixIndex() { + if util.IsMutexLocked(&autoFixLock) { + return + } + + autoFixLock.Lock() + defer autoFixLock.Unlock() + rootUpdated := treenode.GetRootUpdated() for rootID, updated := range rootUpdated { root := sql.GetBlock(rootID)