fix(services): clean up dependent resources during service deletion
This commit is contained in:
@@ -198,6 +198,18 @@ export class CloudlyBackupManager {
|
||||
return await backup.createSavableObject();
|
||||
}
|
||||
|
||||
public async deleteBackupsForService(serviceIdArg: string): Promise<void> {
|
||||
const backups = await this.CBackupRecord.getInstances({
|
||||
serviceId: serviceIdArg,
|
||||
});
|
||||
for (const backup of backups) {
|
||||
if (backup.replication?.targetPath) {
|
||||
await this.getBackupTargetWriter().deletePrefix(backup.replication.targetPath);
|
||||
}
|
||||
await backup.delete();
|
||||
}
|
||||
}
|
||||
|
||||
public async backupAllServices() {
|
||||
const services = await this.cloudlyRef.serviceManager.CService.getInstances({});
|
||||
const results: Array<{ serviceId: string; backupId?: string; errorText?: string }> = [];
|
||||
|
||||
Reference in New Issue
Block a user