From cdd4f1c29bcfc729ac063fb3fc2f58f1c62ebbfe Mon Sep 17 00:00:00 2001 From: Cassie Tarakajian Date: Tue, 26 Dec 2017 21:54:09 -0500 Subject: [PATCH] need to limit the number of projects loaded into runtime memory... --- server/migrations/moveBucket.js | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/server/migrations/moveBucket.js b/server/migrations/moveBucket.js index cfb43250..aeaa4b78 100644 --- a/server/migrations/moveBucket.js +++ b/server/migrations/moveBucket.js @@ -1,5 +1,4 @@ /* eslint-disable */ -console.log('in move bucket'); import s3 from 's3'; import path from 'path'; import mongoose from 'mongoose'; @@ -25,17 +24,21 @@ mongoose.connection.on('error', () => { // }, // }); -Project.find({}, (err, projects) => { - projects.forEach((project, projectIndex) => { - console.log(project.name); - project.files.forEach((file, fileIndex) => { - if (file.url && file.url.includes('p5.js-webeditor')) { - 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); - }); - }); - }); -}); \ No newline at end of file +const numProjects = Project.count({}); +console.log(numProjects); +process.exit(0); + +// Project.find({}, (err, projects) => { +// projects.forEach((project, projectIndex) => { +// console.log(project.name); +// project.files.forEach((file, fileIndex) => { +// if (file.url && file.url.includes('p5.js-webeditor')) { +// 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); +// }); +// }); +// }); +// }); \ No newline at end of file