diff --git a/src/tasks.js b/src/tasks.js index be70f8f02..250bd6484 100644 --- a/src/tasks.js +++ b/src/tasks.js @@ -19,6 +19,7 @@ exports = module.exports = { _del: del, // task types. if you add a task here, fill up the function table in taskworker and dashboard constants.js + // '_' prefix is removed for lookup TASK_APP: 'app', TASK_APP_BACKUP_PREFIX: 'appBackup_', TASK_BACKUP: 'backup', // full backup diff --git a/src/taskworker.js b/src/taskworker.js index 5d528db63..b7b2e56a9 100755 --- a/src/taskworker.js +++ b/src/taskworker.js @@ -109,7 +109,7 @@ async function main() { try { debug(`Running task of type ${task.type}`); - const [runError, result] = await safe(TASKS[task.type].apply(null, task.args.concat(progressCallback))); + const [runError, result] = await safe(TASKS[task.type.replace(/_.*/,'')].apply(null, task.args.concat(progressCallback))); const progress = { result: result || null, error: runError ? JSON.parse(JSON.stringify(runError, Object.getOwnPropertyNames(runError))) : null,