mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
🎨 Improve performance for listing doc tree
This commit is contained in:
parent
95a7ba100d
commit
afdce4b1c7
1 changed files with 0 additions and 15 deletions
|
@ -240,21 +240,6 @@ func ListDocTree(boxID, listPath string, sortMode int, flashcard, showHidden boo
|
|||
|
||||
ret = []*File{}
|
||||
|
||||
// 同一个路径条件不允许并发请求,主要是为了性能考虑,并发请求的话会导致缓存穿透
|
||||
listLockKey := boxID + listPath + strconv.Itoa(sortMode) + strconv.FormatBool(flashcard) + strconv.FormatBool(showHidden) + strconv.Itoa(maxListCount)
|
||||
if v, ok := listDocTreeLock.Load(listLockKey); ok {
|
||||
v.(*sync.Mutex).Lock()
|
||||
defer v.(*sync.Mutex).Unlock()
|
||||
} else {
|
||||
mu := &sync.Mutex{}
|
||||
mu.Lock()
|
||||
listDocTreeLock.Store(listLockKey, mu)
|
||||
defer func() {
|
||||
mu.Unlock()
|
||||
listDocTreeLock.Delete(listLockKey)
|
||||
}()
|
||||
}
|
||||
|
||||
var deck *riff.Deck
|
||||
var deckBlockIDs []string
|
||||
if flashcard {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue