Fix backup all and disable full check for migration

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2025-03-05 14:19:03 +07:00
parent cc0cb34ba6
commit 88813b5e5b
No known key found for this signature in database
GPG Key ID: BD80F68D68D8F7F2
2 changed files with 15 additions and 5 deletions

View File

@ -787,7 +787,12 @@ export function devTool (
const skipped = new Set(cmd.skip.split(',').map((it) => it.trim()))
await withAccountDatabase(async (db) => {
const workspaces = (await listWorkspacesPure(db))
.sort((a, b) => a.lastVisit - b.lastVisit)
.sort((a, b) => {
const bsize = b.backupInfo?.backupSize ?? 0
const asize = a.backupInfo?.backupSize ?? 0
return bsize - asize
})
.filter((it) => isActiveMode(it.mode))
.filter((it) => (cmd.workspace === '' || cmd.workspace === it.workspace) && !skipped.has(it.workspace))
let processed = 0

View File

@ -450,7 +450,7 @@ export class WorkspaceWorker {
await sendEvent('archiving-backup-started', 0)
await this.sendTransactorMaitenance(token, { name: workspace.workspace })
if (await this.doBackup(ctx, workspace, opt)) {
if (await this.doBackup(ctx, workspace, opt, true)) {
await sendEvent('archiving-backup-done', 100)
}
break
@ -487,7 +487,7 @@ export class WorkspaceWorker {
case 'migration-backup':
await sendEvent('migrate-backup-started', 0)
await this.sendTransactorMaitenance(token, { name: workspace.workspace })
if (await this.doBackup(ctx, workspace, opt)) {
if (await this.doBackup(ctx, workspace, opt, false)) {
await sendEvent('migrate-backup-done', 100)
}
break
@ -522,7 +522,12 @@ export class WorkspaceWorker {
}
}
private async doBackup (ctx: MeasureContext, workspace: BaseWorkspaceInfo, opt: WorkspaceOptions): Promise<boolean> {
private async doBackup (
ctx: MeasureContext,
workspace: BaseWorkspaceInfo,
opt: WorkspaceOptions,
doFullCheck: boolean
): Promise<boolean> {
if (opt.backup === undefined) {
return false
}
@ -583,7 +588,7 @@ export class WorkspaceWorker {
50000,
['blob'],
sharedPipelineContextVars,
true, // Do a full check
doFullCheck, // Do full check based on config, do not do for migration, it is to slow, will perform before migration.
(_p: number) => {
if (progress !== Math.round(_p)) {
progress = Math.round(_p)