need to limit the number of projects loaded into runtime memory...

This commit is contained in:
Cassie Tarakajian 2017-12-26 21:54:09 -05:00
parent 0ba9f33f09
commit cdd4f1c29b

View file

@ -1,5 +1,4 @@
/* eslint-disable */ /* eslint-disable */
console.log('in move bucket');
import s3 from 's3'; import s3 from 's3';
import path from 'path'; import path from 'path';
import mongoose from 'mongoose'; import mongoose from 'mongoose';
@ -25,17 +24,21 @@ mongoose.connection.on('error', () => {
// }, // },
// }); // });
Project.find({}, (err, projects) => { const numProjects = Project.count({});
projects.forEach((project, projectIndex) => { console.log(numProjects);
console.log(project.name); process.exit(0);
project.files.forEach((file, fileIndex) => {
if (file.url && file.url.includes('p5.js-webeditor')) { // Project.find({}, (err, projects) => {
file.url = file.url.replace('p5.js-webeditor', process.env.S3_BUCKET); // projects.forEach((project, projectIndex) => {
} // console.log(project.name);
project.save((err, savedProject) => { // project.files.forEach((file, fileIndex) => {
console.log(`updated file ${file.url}`); // if (file.url && file.url.includes('p5.js-webeditor')) {
process.exit(0); // file.url = file.url.replace('p5.js-webeditor', process.env.S3_BUCKET);
}); // }
}); // project.save((err, savedProject) => {
}); // console.log(`updated file ${file.url}`);
}); // process.exit(0);
// });
// });
// });
// });