backups: add stop_integrity_check route

This commit is contained in:
Girish Ramakrishnan
2026-02-09 21:58:40 +01:00
parent 26a3cf79c5
commit 93a0063941
6 changed files with 58 additions and 14 deletions
+10
View File
@@ -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');
}