fix callback mismatch
This commit is contained in:
parent
4d5f18b1de
commit
a11e37116a
1 changed files with 5 additions and 4 deletions
|
@ -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,12 +50,12 @@ Project.count({})
|
|||
}
|
||||
}, () => {
|
||||
cb();
|
||||
});
|
||||
}, () => {
|
||||
index += CHUNK;
|
||||
whilstCb();
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
() => {
|
||||
console.log('finished processing all documents.')
|
||||
|
|
Loading…
Reference in a new issue