1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-01-17 18:26:17 +02:00

cleanup import blocks

This commit is contained in:
Chen-I Lim 2021-03-02 18:09:13 -08:00
parent ab7d936e9f
commit 7760cfa9ae

View File

@ -39,8 +39,8 @@ class Archiver {
private static async importBlocksFromFile(file: File): Promise<void> {
let blockCount = 0
const maxBlocksPerImport = 100
const blocks: IBlock[] = []
const maxBlocksPerImport = 1000
let blocks: IBlock[] = []
let isFirstLine = true
return new Promise<void>((resolve) => {
@ -75,9 +75,10 @@ class Archiver {
if (Archiver.isValidBlock(block)) {
blocks.push(block)
if (blocks.length >= maxBlocksPerImport) {
await mutator.importFullArchive(blocks)
blockCount += blocks.length
blocks.length = 0
const blocksToSend = blocks
blocks = []
await mutator.importFullArchive(blocksToSend)
blockCount += blocksToSend.length
}
}
break