diff --git a/server/lib/databaseMigrateToSequelize.js b/server/lib/databaseMigrateToSequelize.js index 153044b6..7deb8061 100644 --- a/server/lib/databaseMigrateToSequelize.js +++ b/server/lib/databaseMigrateToSequelize.js @@ -84,49 +84,44 @@ function migrateData(title, stream, deal, callback) { console.log("Migrating "+title); console.log(); - var number = 0; - var ended = false; - - stream.on("data", function(data) { + var queue = async.queue(function(data, next) { data = JSON.parse(JSON.stringify(data)); data.id = data._id; delete data._id; var queries = deal(data); - var outstandingQueries = queries.length; - if(queries.length == 0) - return check(); - - number++; - - for(var i=0; i