浏览代码

:art: logging

Liang Ding 3 年之前
父节点
当前提交
97c26981b3
共有 3 个文件被更改,包括 9 次插入2 次删除
  1. 1 1
      kernel/go.mod
  2. 2 0
      kernel/go.sum
  3. 6 1
      kernel/model/repository.go

+ 1 - 1
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

+ 2 - 0
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=

+ 6 - 1
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
 }