Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2023-12-09 17:52:22 +08:00
commit 1dc5a371f6
6 changed files with 18 additions and 54 deletions

View file

@ -114,22 +114,6 @@ func LoadTreeByData(data []byte, boxID, p string, luteEngine *lute.Lute) (ret *p
return
}
func WriteTreeWithoutChangeTime(tree *parse.Tree) (err error) {
data, filePath, err := prepareWriteTree(tree)
if nil != err {
return
}
if err = filelock.WriteFileWithoutChangeTime(filePath, data); nil != err {
msg := fmt.Sprintf("write data [%s] failed: %s", filePath, err)
logging.LogErrorf(msg)
return errors.New(msg)
}
afterWriteTree(tree)
return
}
func WriteTree(tree *parse.Tree) (err error) {
data, filePath, err := prepareWriteTree(tree)
if nil != err {

View file

@ -8,7 +8,7 @@ require (
code.sajari.com/docconv v1.3.8
github.com/88250/clipboard v0.1.5
github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48
github.com/88250/gulu v1.2.3-0.20231208041529-dafc64f2bd1d
github.com/88250/gulu v1.2.3-0.20231209020950-b7b6994e395c
github.com/88250/lute v1.7.6-0.20231205144411-36eb02d113a6
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
@ -50,10 +50,10 @@ require (
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-20231208142721-8ee5cca6b637
github.com/siyuan-note/dejavu v0.0.0-20231209022337-1ab041167449
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75
github.com/siyuan-note/eventbus v0.0.0-20230804030110-cf250f838c80
github.com/siyuan-note/filelock v0.0.0-20231206081043-b75b363ddb1b
github.com/siyuan-note/filelock v0.0.0-20231209021753-ecf23a6be73b
github.com/siyuan-note/httpclient v0.0.0-20231120083123-750db4d28b38
github.com/siyuan-note/logging v0.0.0-20231208035918-61f884c854f0
github.com/siyuan-note/riff v0.0.0-20231128081053-0cd7a5fa0076
@ -78,7 +78,7 @@ require (
github.com/andybalholm/brotli v1.0.6 // indirect
github.com/andybalholm/cascadia v1.3.2 // indirect
github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef // indirect
github.com/aws/aws-sdk-go v1.48.15 // indirect
github.com/aws/aws-sdk-go v1.48.16 // indirect
github.com/bytedance/sonic v1.10.2 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect

View file

@ -8,8 +8,8 @@ github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48 h1:qiE88Pw/9GG8hvMfpfB4
github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48/go.mod h1:UgVSq5iO9pOvqs3hIGNVk6WXDiAB0v3Dlg4nssQJ7W4=
github.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5 h1:8HdZozCsXSiEXYAo8Zbi/r2Ld6Dd4MmGHgir3EaSuHQ=
github.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/88250/gulu v1.2.3-0.20231208041529-dafc64f2bd1d h1:5v2fUykQ2LHVLjYH6hitmpGQ4q9NIFTzdncnI7TNkaY=
github.com/88250/gulu v1.2.3-0.20231208041529-dafc64f2bd1d/go.mod h1:pTWnjt+6qUqNnP9xltswsJxgCBVu3C7eW09u48LWX0k=
github.com/88250/gulu v1.2.3-0.20231209020950-b7b6994e395c h1:Fas3hxqP33xA9KKDV50jUmppiiOukk5bdV00Hk5VSSk=
github.com/88250/gulu v1.2.3-0.20231209020950-b7b6994e395c/go.mod h1:pTWnjt+6qUqNnP9xltswsJxgCBVu3C7eW09u48LWX0k=
github.com/88250/lute v1.7.6-0.20231205144411-36eb02d113a6 h1:nCZMMQB5XqhX2jJYegnmrlBAYKotE7Cwex17Kz24rko=
github.com/88250/lute v1.7.6-0.20231205144411-36eb02d113a6/go.mod h1:+wUqx/1kdFDbWtxn9LYJlaCOAeol2pjSO6w+WJTVQsg=
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c h1:Dl/8S9iLyPMTElnWIBxmjaLiWrkI5P4a21ivwAn5pU0=
@ -49,8 +49,8 @@ github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de h1:FxWPpzIjnTlhP
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de/go.mod h1:DCaWoUhZrYW9p1lxo/cm8EmUOOzAPSEZNGF2DK1dJgw=
github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef h1:2JGTg6JapxP9/R33ZaagQtAM4EkkSYnIAlOG5EI8gkM=
github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef/go.mod h1:JS7hed4L1fj0hXcyEejnW57/7LCetXggd+vwrRnYeII=
github.com/aws/aws-sdk-go v1.48.15 h1:Gad2C4pLzuZDd5CA0Rvkfko6qUDDTOYru145gkO7w/Y=
github.com/aws/aws-sdk-go v1.48.15/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk=
github.com/aws/aws-sdk-go v1.48.16 h1:mcj2/9J/MJ55Dov+ocMevhR8Jv6jW/fAxbrn4a1JFc8=
github.com/aws/aws-sdk-go v1.48.16/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk=
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM=
github.com/bytedance/sonic v1.10.2 h1:GQebETVBxYB7JGWJtLBi07OVzWwt+8dWA00gEVW2ZFE=
@ -356,14 +356,14 @@ 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-20231208142721-8ee5cca6b637 h1:wn/tFUTCIpISY1l8IgDoAES7O3geASvnHHJJGY7snU8=
github.com/siyuan-note/dejavu v0.0.0-20231208142721-8ee5cca6b637/go.mod h1:JFtbncCYIJft4Krp7U8wdxfqmV7DzpVpfBwz/KGUjX4=
github.com/siyuan-note/dejavu v0.0.0-20231209022337-1ab041167449 h1:gyS0N7IxhBu73K8ROhvMhXAEGKuqV7yKH41usbA2G3c=
github.com/siyuan-note/dejavu v0.0.0-20231209022337-1ab041167449/go.mod h1:3rwKzSj5NnzhJ181Ln3BIQdOyYBskR/z7j88MjqXgLY=
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-20230804030110-cf250f838c80 h1:XghjHKJd+SiL0DkGYFVC+UGUDFtnR4v9gkAbPeh9Eq8=
github.com/siyuan-note/eventbus v0.0.0-20230804030110-cf250f838c80/go.mod h1:Sqo4FYX5lAXu7gWkbEdJF0e6P57tNNVV4WDKYDctokI=
github.com/siyuan-note/filelock v0.0.0-20231206081043-b75b363ddb1b h1:zl/gZ/6emGWvyIQSrs/au/2K4pnVnu0hgGjH29RfoXM=
github.com/siyuan-note/filelock v0.0.0-20231206081043-b75b363ddb1b/go.mod h1:4teUA+79ESPDbagztng2dJfyv66pGrri5ldGJQG/saI=
github.com/siyuan-note/filelock v0.0.0-20231209021753-ecf23a6be73b h1:IKSZ7xR5ks7bUpxbfwBPb9lgFuLTrgpNXtzMfTKBlV8=
github.com/siyuan-note/filelock v0.0.0-20231209021753-ecf23a6be73b/go.mod h1:++qrlYXSLss5AtNrHm3MNtDAQSI2gT8m3m15zLPjWJg=
github.com/siyuan-note/httpclient v0.0.0-20231120083123-750db4d28b38 h1:deUrbUOwmsNYRT0x12GHaJ8exxmDMwXFL/1J4dVnLMM=
github.com/siyuan-note/httpclient v0.0.0-20231120083123-750db4d28b38/go.mod h1:QOTSBBSeKU90Kb4aeDVcQ0G+2zJcNuhkwAlsJ2cnmkQ=
github.com/siyuan-note/logging v0.0.0-20231208035918-61f884c854f0 h1:+XjUr9UMXsczdO2bGA72p/k9wa2ShPb8ybi7CDBJ7HQ=

View file

@ -122,15 +122,8 @@ func setNodeAttrs(node *ast.Node, tree *parse.Tree, nameValues map[string]string
return
}
if 1 == len(nameValues) && "" != nameValues["scroll"] {
// 文档滚动状态不产生同步冲突 https://github.com/siyuan-note/siyuan/issues/6076
if err = indexWriteJSONQueueWithoutChangeTime(tree); nil != err {
return
}
} else {
if err = indexWriteJSONQueue(tree); nil != err {
return
}
if err = indexWriteJSONQueue(tree); nil != err {
return
}
IncSync()

View file

@ -967,24 +967,11 @@ func writeJSONQueue(tree *parse.Tree) (err error) {
return
}
func writeJSONQueueWithoutChangeTime(tree *parse.Tree) (err error) {
if err = filesys.WriteTreeWithoutChangeTime(tree); nil != err {
return
}
sql.UpsertTreeQueue(tree)
return
}
func indexWriteJSONQueue(tree *parse.Tree) (err error) {
treenode.IndexBlockTree(tree)
return writeJSONQueue(tree)
}
func indexWriteJSONQueueWithoutChangeTime(tree *parse.Tree) (err error) {
treenode.IndexBlockTree(tree)
return writeJSONQueueWithoutChangeTime(tree)
}
func renameWriteJSONQueue(tree *parse.Tree) (err error) {
if err = filesys.WriteTree(tree); nil != err {
return

View file

@ -238,8 +238,8 @@ func RemoveBlockTreesByRootID(rootID string) {
slice := val.(*btSlice)
slice.m.Lock()
delete(slice.data, id)
slice.m.Unlock()
slice.changed = time.Now()
slice.m.Unlock()
}
}
@ -296,8 +296,8 @@ func RemoveBlockTreesByPathPrefix(pathPrefix string) {
slice := val.(*btSlice)
slice.m.Lock()
delete(slice.data, id)
slice.m.Unlock()
slice.changed = time.Now()
slice.m.Unlock()
}
}
@ -338,8 +338,8 @@ func RemoveBlockTreesByBoxID(boxID string) (ids []string) {
slice := val.(*btSlice)
slice.m.Lock()
delete(slice.data, id)
slice.m.Unlock()
slice.changed = time.Now()
slice.m.Unlock()
}
return
}
@ -352,8 +352,8 @@ func RemoveBlockTree(id string) {
slice := val.(*btSlice)
slice.m.Lock()
delete(slice.data, id)
slice.m.Unlock()
slice.changed = time.Now()
slice.m.Unlock()
}
func IndexBlockTree(tree *parse.Tree) {