This commit is contained in:
Liang Ding 2022-06-13 22:29:30 +08:00
parent 50c243ac69
commit a0e1e2249a
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -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