From 03809713278398b3b21e27d4853ed30a39d6aa36 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Wed, 7 Sep 2022 22:49:29 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=A1=8C=E9=9D=A2=E7=AB=AF=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E4=B8=8B=E8=BD=BD=E6=9B=B4=E6=96=B0=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E5=8C=85=20https://github.com/siyuan-note/siyuan/issues/5837?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/updater.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kernel/model/updater.go b/kernel/model/updater.go index 03d833618..73fe68ceb 100644 --- a/kernel/model/updater.go +++ b/kernel/model/updater.go @@ -24,6 +24,7 @@ import ( "os" "path/filepath" "runtime" + "sync" "github.com/88250/gulu" "github.com/imroc/req/v3" @@ -31,11 +32,20 @@ import ( "github.com/siyuan-note/siyuan/kernel/util" ) +var checkDownloadInstallPkgLock = sync.Mutex{} + func checkDownloadInstallPkg() { if !Conf.System.DownloadInstallPkg { return } + if util.IsMutexLocked(&checkDownloadInstallPkgLock) { + return + } + + checkDownloadInstallPkgLock.Lock() + defer checkDownloadInstallPkgLock.Unlock() + result, err := util.GetRhyResult(false) if nil != err { return