From a0e1e2249aa3336df91627fde491af671aa64f51 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Mon, 13 Jun 2022 22:29:30 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=95=B0=E6=8D=AE=E5=BF=AB=E7=85=A7=20?= =?UTF-8?q?https://github.com/siyuan-note/siyuan/issues/5159?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/repository.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/kernel/model/repository.go b/kernel/model/repository.go index 561a9071a..9950b9135 100644 --- a/kernel/model/repository.go +++ b/kernel/model/repository.go @@ -23,7 +23,9 @@ import ( "os" "github.com/siyuan-note/dejavu" + "github.com/siyuan-note/dejavu/entity" "github.com/siyuan-note/encryption" + "github.com/siyuan-note/siyuan/kernel/filesys" "github.com/siyuan-note/siyuan/kernel/util" ) @@ -96,10 +98,10 @@ var indexCallbacks = map[string]dejavu.Callback{ context.(func(msg string))(arg.(string)) }, "getLatestFile": func(context, arg interface{}, err error) { - context.(func(msg string))(arg.(string)) + context.(func(msg string))(arg.(*entity.File).Path) }, "upsertFile": func(context, arg interface{}, err error) { - context.(func(msg string))(arg.(string)) + context.(func(msg string))(arg.(*entity.File).Path) }, } @@ -114,6 +116,10 @@ func IndexRepo(message string) (err error) { return } + WaitForWritingFiles() + syncLock.Lock() + defer syncLock.Unlock() + filesys.ReleaseAllFileLocks() _, err = repo.Index(message, util.PushEndlessProgress, indexCallbacks) util.PushClearProgress() return