backups: recursively update the dep preserveSecs
One idea was to compute this at cleanup time, but this has two problems: * the UI won't reflect this value. can be good or bad * the cleaner has no easy way to find out the "parent". I guess we should change our data structure, if we want to go down this route...
This commit is contained in:
@@ -797,13 +797,14 @@ async function rotateBoxBackup(backupConfig, tag, options, dependsOn, progressCa
|
||||
identifier: backups.BACKUP_IDENTIFIER_BOX,
|
||||
dependsOn,
|
||||
manifest: null,
|
||||
format
|
||||
format,
|
||||
preserveSecs: options.preserveSecs || 0
|
||||
};
|
||||
|
||||
const id = await backups.add(data);
|
||||
const [copyBackupError] = await safe(copy(backupConfig, 'snapshot/box', remotePath, progressCallback));
|
||||
const state = copyBackupError ? backups.BACKUP_STATE_ERROR : backups.BACKUP_STATE_NORMAL;
|
||||
await backups.update(id, { preserveSecs: options.preserveSecs || 0, state });
|
||||
await backups.setState(id, state);
|
||||
if (copyBackupError) throw copyBackupError;
|
||||
|
||||
return id;
|
||||
@@ -843,15 +844,16 @@ async function rotateAppBackup(backupConfig, app, tag, options, progressCallback
|
||||
type: backups.BACKUP_TYPE_APP,
|
||||
state: backups.BACKUP_STATE_CREATING,
|
||||
identifier: app.id,
|
||||
dependsOn: [ ],
|
||||
dependsOn: [],
|
||||
manifest,
|
||||
format: format
|
||||
format,
|
||||
preserveSecs: options.preserveSecs || 0
|
||||
};
|
||||
|
||||
const id = await backups.add(data);
|
||||
const copyBackupError = await safe(copy(backupConfig, `snapshot/app_${app.id}`, remotePath, progressCallback));
|
||||
const state = copyBackupError ? backups.BACKUP_STATE_ERROR : backups.BACKUP_STATE_NORMAL;
|
||||
await backups.update(id, { preserveSecs: options.preserveSecs || 0, state });
|
||||
await backups.setState(id, state);
|
||||
if (copyBackupError) throw copyBackupError;
|
||||
|
||||
return id;
|
||||
@@ -979,13 +981,14 @@ async function rotateMailBackup(backupConfig, tag, options, progressCallback) {
|
||||
identifier: backups.BACKUP_IDENTIFIER_MAIL,
|
||||
dependsOn: [],
|
||||
manifest: null,
|
||||
format: format
|
||||
format,
|
||||
preserveSecs: options.preserveSecs || 0
|
||||
};
|
||||
|
||||
const id = await backups.add(data);
|
||||
const [copyBackupError] = await safe(copy(backupConfig, 'snapshot/mail', remotePath, progressCallback));
|
||||
const state = copyBackupError ? backups.BACKUP_STATE_ERROR : backups.BACKUP_STATE_NORMAL;
|
||||
await backups.update(id, { preserveSecs: options.preserveSecs || 0, state });
|
||||
await backups.setState(id, state);
|
||||
if (copyBackupError) throw copyBackupError;
|
||||
|
||||
return id;
|
||||
|
||||
Reference in New Issue
Block a user