Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: logging

Liang Ding97c26981b3a8
diff --git a/kernel/go.mod b/kernel/go.mod
index 8a3c0ae09e..ec330e8e88 100644
--- a/kernel/go.mod
+++ b/kernel/go.mod
@@ -40,7 +40,7 @@ require (
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/qiniu/go-sdk/v7 v7.13.0
github.com/radovskyb/watcher v1.0.7
- github.com/siyuan-note/dejavu v0.0.0-20220625144051-1523833b73f8
+ github.com/siyuan-note/dejavu v0.0.0-20220625155717-0da3d8498e22
github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676
github.com/siyuan-note/eventbus v0.0.0-20220624162334-ca7c06dc771f
github.com/siyuan-note/filelock v0.0.0-20220616063212-74cfba0754ee
diff --git a/kernel/go.sum b/kernel/go.sum
index b5b7301307..8363fe3aa7 100644
--- a/kernel/go.sum
+++ b/kernel/go.sum
@@ -423,6 +423,8 @@ github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJV
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/siyuan-note/dejavu v0.0.0-20220625144051-1523833b73f8 h1:LMbbMd86LMCV5GsGqwDKHUcTTjRfGGbiuZ4ZDYsAD/0=
github.com/siyuan-note/dejavu v0.0.0-20220625144051-1523833b73f8/go.mod h1:i7dnOgHM41EA7xIX2CYSxYe0WhksGZidQQsLvWryK7w=
+github.com/siyuan-note/dejavu v0.0.0-20220625155717-0da3d8498e22 h1:FFIWd0VDWxZlyGWWSxvmsXMsxtu5tjFE/KBBaUFEEK0=
+github.com/siyuan-note/dejavu v0.0.0-20220625155717-0da3d8498e22/go.mod h1:i7dnOgHM41EA7xIX2CYSxYe0WhksGZidQQsLvWryK7w=
github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676 h1:QB9TjJQFhXhZ6dAtPpY02DlzHAQm1C+WqZq6OadG8mI=
github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw=
github.com/siyuan-note/eventbus v0.0.0-20220624162334-ca7c06dc771f h1:JMobMNZ7AqaKKyEK+WeWFhix/2TDQXgPZDajU00IybU=
diff --git a/kernel/model/repository.go b/kernel/model/repository.go
index 8de5477c89..a4a9649876 100644
--- a/kernel/model/repository.go
+++ b/kernel/model/repository.go
@@ -358,12 +358,17 @@ func IndexRepo(memo string) (err error) {
util.PushEndlessProgress(Conf.Language(143))
writingDataLock.Lock()
defer writingDataLock.Unlock()
+
+ start := time.Now()
WaitForWritingFiles()
sql.WaitForWritingDatabase()
filelock.ReleaseAllFileLocks()
_, err = repo.Index(memo, map[string]interface{}{
CtxPushMsg: CtxPushMsgToStatusBarAndProgress,
})
+ elapsed := time.Since(start)
+ util.LogInfof("index data repo elapsed [%.2fs]", elapsed.Seconds())
+ util.PushStatusBar(fmt.Sprintf("Index data repo elapsed [%.2fs]", elapsed.Seconds()))
util.PushClearProgress()
return
}
@@ -428,6 +433,6 @@ func syncRepo() (err error) {
})
elapsed := time.Since(start)
util.LogInfof("sync data repo elapsed [%.2fs]", elapsed.Seconds())
- util.PushStatusBar(fmt.Sprintf("Sync data data repo elapsed [%.2fs]", elapsed.Seconds()))
+ util.PushStatusBar(fmt.Sprintf("Sync data repo elapsed [%.2fs]", elapsed.Seconds()))
return
}