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

View File

@@ -23,11 +23,11 @@ var async = require('async'),
tasks = require('../tasks.js');
function createBackup(callback) {
tasks.startTask(tasks.TASK_BACKUP, [], { username: 'test' }, function (error) { // this call does not wait for the backup!
tasks.startTask(tasks.TASK_BACKUP, [], { username: 'test' }, function (error, taskId) { // this call does not wait for the backup!
if (error) return callback(error);
function waitForBackup() {
tasks.get(tasks.TASK_BACKUP, function (error, p) {
tasks.get(taskId, function (error, p) {
if (error) return callback(error);
if (p.percent !== 100) return setTimeout(waitForBackup, 1000);