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({})
|
Project.count({})
|
||||||
.exec().then((numProjects) => {
|
.exec().then((numProjects) => {
|
||||||
console.log(numProjects);
|
console.log(numProjects);
|
||||||
|
@ -37,6 +37,7 @@ Project.count({})
|
||||||
(whilstCb) => {
|
(whilstCb) => {
|
||||||
Project.find({}).skip(index).limit(CHUNK).exec((err, projects) => {
|
Project.find({}).skip(index).limit(CHUNK).exec((err, projects) => {
|
||||||
async.eachSeries(projects, (project, cb) => {
|
async.eachSeries(projects, (project, cb) => {
|
||||||
|
console.log(project.name);
|
||||||
async.eachSeries(project.files, (file, fileCb) => {
|
async.eachSeries(project.files, (file, fileCb) => {
|
||||||
if (file.url && file.url.includes('p5.js-webeditor')) {
|
if (file.url && file.url.includes('p5.js-webeditor')) {
|
||||||
file.url = file.url.replace('p5.js-webeditor', process.env.S3_BUCKET);
|
file.url = file.url.replace('p5.js-webeditor', process.env.S3_BUCKET);
|
||||||
|
@ -49,10 +50,10 @@ Project.count({})
|
||||||
}
|
}
|
||||||
}, () => {
|
}, () => {
|
||||||
cb();
|
cb();
|
||||||
}, () => {
|
|
||||||
index += CHUNK;
|
|
||||||
whilstCb();
|
|
||||||
});
|
});
|
||||||
|
}, () => {
|
||||||
|
index += CHUNK;
|
||||||
|
whilstCb();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue