Make tasks indexed by id instead of type

The caas migrate logic is broken at this point until it uses new
task framework
This commit is contained in:
Girish Ramakrishnan
2018-12-08 18:50:06 -08:00
parent cfb68a0511
commit d8225ad653
12 changed files with 174 additions and 107 deletions
+2 -2
View File
@@ -36,10 +36,10 @@ function list(req, res, next) {
function startBackup(req, res, next) {
// note that cloudron.backup only waits for backup initiation and not for backup to complete
// backup progress can be checked up ny polling the progress api call
tasks.startTask(tasks.TASK_BACKUP, {}, auditSource(req), function (error) {
tasks.startTask(tasks.TASK_BACKUP, {}, auditSource(req), function (error, taskId) {
if (error && error.reason === TasksError.BAD_STATE) return next(new HttpError(409, error.message));
if (error) return next(new HttpError(500, error));
next(new HttpSuccess(202, {}));
next(new HttpSuccess(202, { taskId }));
});
}