mirror of https://github.com/certd/certd
perf: 清理数据库备份的临时目录
parent
ff10bc05ec
commit
fd95549de9
|
@ -202,16 +202,22 @@ export class DBBackupPlugin extends AbstractPlusTaskPlugin {
|
||||||
const backupDir = this.backupDir || defaultBackupDir;
|
const backupDir = this.backupDir || defaultBackupDir;
|
||||||
const backupFilePath = `${backupDir}/${dbZipFilename}`;
|
const backupFilePath = `${backupDir}/${dbZipFilename}`;
|
||||||
|
|
||||||
if (this.backupMode === 'local') {
|
try{
|
||||||
await this.localBackup(dbZipPath, backupDir, backupFilePath);
|
if (this.backupMode === 'local') {
|
||||||
} else if (this.backupMode === 'ssh') {
|
await this.localBackup(dbZipPath, backupDir, backupFilePath);
|
||||||
await this.sshBackup(dbZipPath, backupDir, backupFilePath);
|
} else if (this.backupMode === 'ssh') {
|
||||||
} else if (this.backupMode === 'oss') {
|
await this.sshBackup(dbZipPath, backupDir, backupFilePath);
|
||||||
await this.ossBackup(dbZipPath, backupDir, backupFilePath);
|
} else if (this.backupMode === 'oss') {
|
||||||
} else {
|
await this.ossBackup(dbZipPath, backupDir, backupFilePath);
|
||||||
throw new Error(`不支持的备份方式:${this.backupMode}`);
|
} else {
|
||||||
|
throw new Error(`不支持的备份方式:${this.backupMode}`);
|
||||||
|
}
|
||||||
|
}finally{
|
||||||
|
//删除临时目录
|
||||||
|
await fs.promises.rm(tempDir, {recursive: true, force: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.logger.info('数据库备份完成');
|
this.logger.info('数据库备份完成');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue