diff --git a/server/migrations/moveBucket.js b/server/migrations/moveBucket.js index d807e536..21286713 100644 --- a/server/migrations/moveBucket.js +++ b/server/migrations/moveBucket.js @@ -25,7 +25,7 @@ mongoose.connection.on('error', () => { // }, // }); -const CHUNK = 1000; +const CHUNK = 100; Project.count({}) .exec().then((numProjects) => { console.log(numProjects); @@ -37,6 +37,7 @@ Project.count({}) (whilstCb) => { Project.find({}).skip(index).limit(CHUNK).exec((err, projects) => { async.eachSeries(projects, (project, cb) => { + console.log(project.name); async.eachSeries(project.files, (file, fileCb) => { if (file.url && file.url.includes('p5.js-webeditor')) { file.url = file.url.replace('p5.js-webeditor', process.env.S3_BUCKET); @@ -49,10 +50,10 @@ Project.count({}) } }, () => { cb(); - }, () => { - index += CHUNK; - whilstCb(); }); + }, () => { + index += CHUNK; + whilstCb(); }); }); },