🎨 Improve kernel stability by eliminating some data races https://github.com/siyuan-note/siyuan/issues/9842

This commit is contained in:
Daniel 2023-12-11 00:45:23 +08:00
parent 3b3a0cf161
commit 99a2d32abf
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
3 changed files with 6 additions and 11 deletions

View file

@ -44,13 +44,13 @@ require (
github.com/mssola/useragent v1.0.0
github.com/olahol/melody v1.1.4
github.com/open-spaced-repetition/go-fsrs v1.1.0
github.com/panjf2000/ants/v2 v2.8.2
github.com/panjf2000/ants/v2 v2.9.0
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/radovskyb/watcher v1.0.7
github.com/rqlite/sql v0.0.0-20221103124402-8f9ff0ceb8f0
github.com/sashabaranov/go-openai v1.17.9
github.com/shirou/gopsutil/v3 v3.23.11
github.com/siyuan-note/dejavu v0.0.0-20231210162203-822b33543810
github.com/siyuan-note/dejavu v0.0.0-20231210164046-de1bad27c46d
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75
github.com/siyuan-note/eventbus v0.0.0-20231210025112-82fdedd8e374
github.com/siyuan-note/filelock v0.0.0-20231209021753-ecf23a6be73b

View file

@ -290,8 +290,8 @@ github.com/otiai10/gosseract/v2 v2.4.1 h1:G8AyBpXEeSlcq8TI85LH/pM5SXk8Djy2GEXisg
github.com/otiai10/gosseract/v2 v2.4.1/go.mod h1:1gNWP4Hgr2o7yqWfs6r5bZxAatjOIdqWxJLWsTsembk=
github.com/otiai10/mint v1.6.3 h1:87qsV/aw1F5as1eH1zS/yqHY85ANKVMgkDrf9rcxbQs=
github.com/otiai10/mint v1.6.3/go.mod h1:MJm72SBthJjz8qhefc4z1PYEieWmy8Bku7CjcAqyUSM=
github.com/panjf2000/ants/v2 v2.8.2 h1:D1wfANttg8uXhC9149gRt1PDQ+dLVFjNXkCEycMcvQQ=
github.com/panjf2000/ants/v2 v2.8.2/go.mod h1:7ZxyxsqE4vvW0M7LSD8aI3cKwgFhBHbxnlN8mDqHa1I=
github.com/panjf2000/ants/v2 v2.9.0 h1:SztCLkVxBRigbg+vt0S5QvF5vxAbxbKt09/YfAJ0tEo=
github.com/panjf2000/ants/v2 v2.9.0/go.mod h1:7ZxyxsqE4vvW0M7LSD8aI3cKwgFhBHbxnlN8mDqHa1I=
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo=
@ -356,8 +356,8 @@ github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFR
github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d h1:lvCTyBbr36+tqMccdGMwuEU+hjux/zL6xSmf5S9ITaA=
github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw=
github.com/simplereach/timeutils v1.2.0/go.mod h1:VVbQDfN/FHRZa1LSqcwo4kNZ62OOyqLLGQKYB3pB0Q8=
github.com/siyuan-note/dejavu v0.0.0-20231210162203-822b33543810 h1:PPIpYpk9wJPuqOUSRzGW+kTmLctwmZpkTE8GWpuRItA=
github.com/siyuan-note/dejavu v0.0.0-20231210162203-822b33543810/go.mod h1:srQijEzqLjw/oHe/Fgvz4BBi6aTXVW10N0KLh6US/xM=
github.com/siyuan-note/dejavu v0.0.0-20231210164046-de1bad27c46d h1:WEHg4/sxe8hZyFvnok5YbCI17G/BPs6/Z1ub91gdWgg=
github.com/siyuan-note/dejavu v0.0.0-20231210164046-de1bad27c46d/go.mod h1:hSo1/yfw5tuhfbDdpsGX38iMmalX6sK4hruoPYSswxs=
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 h1:Bi7/7f29LW+Fm0cHc0J1NO1cZqyJwljSWVmfOqVZgaE=
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw=
github.com/siyuan-note/eventbus v0.0.0-20231210025112-82fdedd8e374 h1:haPIOZBOAEQaXsUPUpyZeOeMgw6g/9O7RBbS3d39Ta8=

View file

@ -93,7 +93,6 @@ func index(boxID string) {
treeCount++
i := treeCount
lock.Unlock()
logging.LogInfof("indexing [%s, %d]", file.path, i)
tree, err := filesys.LoadTree(box.ID, file.path, luteEngine)
if nil != err {
logging.LogErrorf("read box [%s] tree [%s] failed: %s", box.ID, file.path, err)
@ -117,17 +116,13 @@ func index(boxID string) {
if 1 < i && 0 == i%64 {
util.PushStatusBar(fmt.Sprintf(Conf.Language(88), i, (len(files))-i))
}
logging.LogInfof("indexed [%s, %d]", file.path, i)
})
i := 0
for _, file := range files {
if file.isdir || !strings.HasSuffix(file.name, ".sy") {
continue
}
waitGroup.Add(1)
i++
logging.LogInfof("[%s, %d]", file.path, i)
invokeErr := p.Invoke(file)
if nil != invokeErr {
logging.LogErrorf("invoke [%s] failed: %s", file.path, invokeErr)