backups: add stop_integrity_check route
This commit is contained in:
@@ -13,6 +13,7 @@ exports = module.exports = {
|
||||
|
||||
clearTasks,
|
||||
startIntegrityCheck,
|
||||
stopIntegrityCheck,
|
||||
setIntegrityResult,
|
||||
|
||||
BACKUP_IDENTIFIER_BOX: 'box',
|
||||
@@ -238,6 +239,15 @@ async function startIntegrityCheck(backup, auditSource) {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
async function stopIntegrityCheck(backup, auditSource) {
|
||||
assert.strictEqual(typeof backup, 'object');
|
||||
assert.strictEqual(typeof auditSource, 'object');
|
||||
|
||||
if (!backup.integrityCheckTaskId) throw new BoxError(BoxError.BAD_STATE, 'task is not active');
|
||||
|
||||
await tasks.stopTask(backup.integrityCheckTaskId);
|
||||
}
|
||||
|
||||
async function clearTasks() {
|
||||
await database.query('UPDATE backups SET integrityCheckTaskId = NULL');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user