another fix
This commit is contained in:
parent
665b1440d3
commit
d4f78e0800
1 changed files with 19 additions and 18 deletions
|
@ -35,25 +35,26 @@ Project.count({})
|
||||||
return index < numProjects;
|
return index < numProjects;
|
||||||
},
|
},
|
||||||
(whilstCb) => {
|
(whilstCb) => {
|
||||||
let projects = await Project.find({}).skip(index).limit(CHUNK).exec();
|
Project.find({}).skip(index).limit(CHUNK).exec((err, projects) => {
|
||||||
async.eachSeries(projects, (project, cb) => {
|
async.eachSeries(projects, (project, cb) => {
|
||||||
console.log(project.name);
|
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);
|
||||||
project.save((err, newProject) => {
|
project.save((err, newProject) => {
|
||||||
console.log(`updated file ${file.url}`);
|
console.log(`updated file ${file.url}`);
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
|
fileCb();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
fileCb();
|
fileCb();
|
||||||
});
|
}
|
||||||
} else {
|
}, () => {
|
||||||
fileCb();
|
cb();
|
||||||
}
|
}, () => {
|
||||||
}, () => {
|
index += CHUNK;
|
||||||
cb();
|
whilstCb();
|
||||||
}, () => {
|
});
|
||||||
index += CHUNK;
|
|
||||||
whilstCb();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue