From 6d1702c6005da9389e8f25614e1064b8152b7e4a Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 13 Apr 2017 16:58:37 -0400 Subject: [PATCH] wait for calls to finish --- src/upgrade.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/upgrade.js b/src/upgrade.js index 60b074a953..50e18d90ce 100644 --- a/src/upgrade.js +++ b/src/upgrade.js @@ -163,8 +163,7 @@ Upgrade.process = function (files, skipCount, callback) { // For backwards compatibility, cross-reference with schemaDate (if found). If a script's date is older, skip it if (scriptExport.timestamp <= schemaDate && semver.lt(version, '1.5.0')) { process.stdout.write('skipped\n'.grey); - db.sortedSetAdd('schemaLog', Date.now(), path.basename(file, '.js')); - return next(); + db.sortedSetAdd('schemaLog', Date.now(), path.basename(file, '.js'), next); } // Do the upgrade... @@ -173,12 +172,9 @@ Upgrade.process = function (files, skipCount, callback) { process.stdout.write('error\n'.red); return next(err); } - - // Record success in schemaLog - db.sortedSetAdd('schemaLog', Date.now(), path.basename(file, '.js')); - process.stdout.write('OK\n'.green); - next(); + // Record success in schemaLog + db.sortedSetAdd('schemaLog', Date.now(), path.basename(file, '.js'), next); }); }, function (err) { if (err) {