diff --git a/scripts/migrations/migrate-tasks-v1.js b/scripts/migrations/migrate-tasks-v1.js index aa37b6b97..365faeb4c 100644 --- a/scripts/migrations/migrate-tasks-v1.js +++ b/scripts/migrations/migrate-tasks-v1.js @@ -10,7 +10,6 @@ var config = require("../../lib/load-config"); var FileStorage = require("../../" + (config.storage || "./storage/file")); var tasks; -var paths; nThen(function (w) { Logger.create(config, w(function (_log) { config.log = _log; diff --git a/storage/tasks.js b/storage/tasks.js index 939c2c0cc..0e09d0ad0 100644 --- a/storage/tasks.js +++ b/storage/tasks.js @@ -285,7 +285,7 @@ var runAll = function (env, cb) { }); }; -var migrate function (env, cb) { +var migrate = function (env, cb) { // list every task list(env, function (err, paths) { if (err) { @@ -307,6 +307,7 @@ var migrate function (env, cb) { }); return; } + task = _task; })); }).nThen(function (w) { if (bypass) { return; } @@ -323,17 +324,17 @@ var migrate function (env, cb) { }).nThen(function (w) { if (bypass) { return; } // remove - remove(env, path, function (err) { + remove(env, path, w(function (err) { if (err) { env.log.error("TASK_MIGRATION_REMOVE", { error: err, path: path, }); } - }); + })); }); }); - nt = nt.nThen(function (w) { + nt = nt.nThen(function () { cb(); }); }, true);