Skip to content

Commit

Permalink
🎨 Improve performance of exporting .sy.zip for notebook #12653
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Oct 1, 2024
1 parent 5ff6d27 commit 0dbc8c2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions kernel/model/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -1567,6 +1567,8 @@ func exportSYZip(boxID, rootDirPath, baseFolderName string, docPaths []string) (
util.PushEndlessProgress(Conf.Language(65))

// 按文件夹结构复制选择的树
count := 0
total := len(trees) + len(refTrees)
for _, tree := range trees {
readPath := filepath.Join(util.DataDir, tree.Box, tree.Path)
data, readErr := filelock.ReadFile(readPath)
Expand All @@ -1586,6 +1588,9 @@ func exportSYZip(boxID, rootDirPath, baseFolderName string, docPaths []string) (
logging.LogErrorf("write export file [%s] failed: %s", writePath, writeErr)
continue
}
count++

util.PushEndlessProgress(fmt.Sprintf(Conf.Language(66), fmt.Sprintf("%d/%d ", count, total)+tree.HPath))
}

// 引用树放在导出文件夹根路径下
Expand All @@ -1603,6 +1608,9 @@ func exportSYZip(boxID, rootDirPath, baseFolderName string, docPaths []string) (
logging.LogErrorf("write export file [%s] failed: %s", writePath, writeErr)
continue
}
count++

util.PushEndlessProgress(fmt.Sprintf(Conf.Language(66), fmt.Sprintf("%d/%d ", count, total)+tree.HPath))
}

// 将引用树合并到选择树中,以便后面一次性导出资源文件
Expand Down

0 comments on commit 0dbc8c2

Please sign in to comment.