mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-22 09:35:00 +02:00
Fix Backup info size display (#7540)
This commit is contained in:
@@ -897,6 +897,12 @@ export async function backup (
|
||||
while (true) {
|
||||
try {
|
||||
const currentChunk = await ctx.with('loadChunk', {}, () => connection.loadChunk(domain, idx))
|
||||
if (domain === DOMAIN_BLOB) {
|
||||
result.blobsSize += currentChunk.size ?? 0
|
||||
} else {
|
||||
result.dataSize += currentChunk.size ?? 0
|
||||
}
|
||||
|
||||
idx = currentChunk.idx
|
||||
ops++
|
||||
|
||||
@@ -1152,12 +1158,6 @@ export async function backup (
|
||||
break
|
||||
}
|
||||
|
||||
if (domain === DOMAIN_BLOB) {
|
||||
result.blobsSize += (d as Blob).size
|
||||
} else {
|
||||
result.dataSize += JSON.stringify(d).length
|
||||
}
|
||||
|
||||
function processChanges (d: Doc, error: boolean = false): void {
|
||||
processed++
|
||||
// Move processed document to processedChanges
|
||||
@@ -1777,6 +1777,7 @@ export async function restore (
|
||||
let loaded = 0
|
||||
let el = 0
|
||||
let chunks = 0
|
||||
let dataSize = 0
|
||||
try {
|
||||
while (true) {
|
||||
if (opt.progress !== undefined) {
|
||||
@@ -1784,6 +1785,7 @@ export async function restore (
|
||||
}
|
||||
const st = Date.now()
|
||||
const it = await connection.loadChunk(c, idx)
|
||||
dataSize += it.size ?? 0
|
||||
chunks++
|
||||
|
||||
idx = it.idx
|
||||
@@ -1808,7 +1810,12 @@ export async function restore (
|
||||
await connection.closeChunk(idx)
|
||||
}
|
||||
}
|
||||
ctx.info('loaded', { loaded, workspace: workspaceId.name })
|
||||
ctx.info('loaded', {
|
||||
domain: c,
|
||||
loaded,
|
||||
workspace: workspaceId.name,
|
||||
dataSize: Math.round((dataSize / (1024 * 1024)) * 100) / 100
|
||||
})
|
||||
ctx.info('\tcompare documents', {
|
||||
size: changeset.size,
|
||||
serverSize: serverChangeset.size,
|
||||
|
||||
Reference in New Issue
Block a user