Fixed issue where restoring a DB backup would cause backup_local_db task to be stuck running

Slightly updated tasks UI
This commit is contained in:
Isaac Abadi
2022-04-21 19:56:09 -04:00
parent a288163644
commit d2d125743e
3 changed files with 10 additions and 5 deletions

View File

@@ -110,7 +110,8 @@ exports.executeTask = async (task_key) => {
exports.executeRun = async (task_key) => {
logger.verbose(`Running task ${task_key}`);
await db_api.updateRecord('tasks', {key: task_key}, {running: true});
// don't set running to true when backup up DB as it will be stick "running" if restored
if (task_key !== 'backup_local_db') await db_api.updateRecord('tasks', {key: task_key}, {running: true});
const data = await TASKS[task_key].run();
await db_api.updateRecord('tasks', {key: task_key}, {data: data, last_ran: Date.now()/1000, running: false});
logger.verbose(`Finished running task ${task_key}`);