⚡ 改进数据快照加载性能 https://github.com/siyuan-note/siyuan/issues/6872
This commit is contained in:
parent
f2b2806d9d
commit
24dbb7c092
1 changed files with 6 additions and 5 deletions
|
@ -76,7 +76,7 @@ func GetRepoSnapshots(page int) (ret []*Snapshot, pageCount, totalCount int, err
|
|||
return
|
||||
}
|
||||
|
||||
logs, pageCount, totalCount, err := repo.GetIndexLogs(page, 16)
|
||||
logs, pageCount, totalCount, err := repo.GetIndexLogs(page, 32)
|
||||
if nil != err {
|
||||
if dejavu.ErrNotFoundIndex == err {
|
||||
logs = []*dejavu.Log{}
|
||||
|
@ -98,6 +98,7 @@ func GetRepoSnapshots(page int) (ret []*Snapshot, pageCount, totalCount int, err
|
|||
func buildSnapshots(logs []*dejavu.Log) (ret []*Snapshot) {
|
||||
for _, l := range logs {
|
||||
typesCount := statTypesByPath(l.Files)
|
||||
l.Files = nil // 置空,否则返回前端数据量太大
|
||||
ret = append(ret, &Snapshot{
|
||||
Log: l,
|
||||
TypesCount: typesCount,
|
||||
|
@ -936,7 +937,7 @@ func subscribeEvents() {
|
|||
indexWalkDataCount := 0
|
||||
eventbus.Subscribe(eventbus.EvtIndexWalkData, func(context map[string]interface{}, path string) {
|
||||
msg := fmt.Sprintf(Conf.Language(158), filepath.Base(path))
|
||||
if 0 == indexWalkDataCount%512 {
|
||||
if 0 == indexWalkDataCount%1024 {
|
||||
util.SetBootDetails(msg)
|
||||
util.ContextPushMsg(context, msg)
|
||||
}
|
||||
|
@ -950,7 +951,7 @@ func subscribeEvents() {
|
|||
getLatestFileCount := 0
|
||||
eventbus.Subscribe(eventbus.EvtIndexGetLatestFile, func(context map[string]interface{}, id string) {
|
||||
msg := fmt.Sprintf(Conf.Language(159), id[:7])
|
||||
if 0 == getLatestFileCount%512 {
|
||||
if 0 == getLatestFileCount%1024 {
|
||||
util.SetBootDetails(msg)
|
||||
util.ContextPushMsg(context, msg)
|
||||
}
|
||||
|
@ -979,7 +980,7 @@ func subscribeEvents() {
|
|||
coWalkDataCount := 0
|
||||
eventbus.Subscribe(eventbus.EvtCheckoutWalkData, func(context map[string]interface{}, path string) {
|
||||
msg := fmt.Sprintf(Conf.Language(161), filepath.Base(path))
|
||||
if 0 == coWalkDataCount%512 {
|
||||
if 0 == coWalkDataCount%1024 {
|
||||
util.SetBootDetails(msg)
|
||||
util.ContextPushMsg(context, msg)
|
||||
}
|
||||
|
@ -1011,7 +1012,7 @@ func subscribeEvents() {
|
|||
eventbus.Subscribe(eventbus.EvtCheckoutRemoveFile, func(context map[string]interface{}, path string) {
|
||||
msg := fmt.Sprintf(Conf.Language(163), filepath.Base(path))
|
||||
util.IncBootProgress(bootProgressPart, msg)
|
||||
if 0 == coRemoveFileCount%512 {
|
||||
if 0 == coRemoveFileCount%1024 {
|
||||
util.ContextPushMsg(context, msg)
|
||||
}
|
||||
coRemoveFileCount++
|
||||
|
|
Loading…
Add table
Reference in a new issue