fix callback mismatch

This commit is contained in:
Cassie Tarakajian 2017-12-27 12:29:36 -05:00
parent 4d5f18b1de
commit a11e37116a

View file

@ -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();
});
});
},