mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-12 18:35:45 +00:00
Fix backup all and disable full check for migration
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
cc0cb34ba6
commit
88813b5e5b
@ -787,7 +787,12 @@ export function devTool (
|
|||||||
const skipped = new Set(cmd.skip.split(',').map((it) => it.trim()))
|
const skipped = new Set(cmd.skip.split(',').map((it) => it.trim()))
|
||||||
await withAccountDatabase(async (db) => {
|
await withAccountDatabase(async (db) => {
|
||||||
const workspaces = (await listWorkspacesPure(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))
|
.filter((it) => (cmd.workspace === '' || cmd.workspace === it.workspace) && !skipped.has(it.workspace))
|
||||||
|
|
||||||
let processed = 0
|
let processed = 0
|
||||||
|
@ -450,7 +450,7 @@ export class WorkspaceWorker {
|
|||||||
await sendEvent('archiving-backup-started', 0)
|
await sendEvent('archiving-backup-started', 0)
|
||||||
|
|
||||||
await this.sendTransactorMaitenance(token, { name: workspace.workspace })
|
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)
|
await sendEvent('archiving-backup-done', 100)
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
@ -487,7 +487,7 @@ export class WorkspaceWorker {
|
|||||||
case 'migration-backup':
|
case 'migration-backup':
|
||||||
await sendEvent('migrate-backup-started', 0)
|
await sendEvent('migrate-backup-started', 0)
|
||||||
await this.sendTransactorMaitenance(token, { name: workspace.workspace })
|
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)
|
await sendEvent('migrate-backup-done', 100)
|
||||||
}
|
}
|
||||||
break
|
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) {
|
if (opt.backup === undefined) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -583,7 +588,7 @@ export class WorkspaceWorker {
|
|||||||
50000,
|
50000,
|
||||||
['blob'],
|
['blob'],
|
||||||
sharedPipelineContextVars,
|
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) => {
|
(_p: number) => {
|
||||||
if (progress !== Math.round(_p)) {
|
if (progress !== Math.round(_p)) {
|
||||||
progress = Math.round(_p)
|
progress = Math.round(_p)
|
||||||
|
Loading…
Reference in New Issue
Block a user