Only running indexing on production startup

master
Mark Moffat 2018-02-11 13:02:47 +01:00
parent 7037e18017
commit a8d5a60ee0
2 changed files with 5 additions and 1 deletions

2
app.js
View File

@ -308,7 +308,7 @@ MongoClient.connect(config.databaseConnectionString, {}, (err, client) => {
// add db to app for routes // add db to app for routes
app.db = db; app.db = db;
// add indexing // run indexing
common.runIndexing(app) common.runIndexing(app)
.then(common.testData(db, app)) .then(common.testData(db, app))
.then(app.listen(app.get('port'))) .then(app.listen(app.get('port')))

View File

@ -582,6 +582,10 @@ exports.indexOrders = (app, cb) => {
// start indexing products and orders // start indexing products and orders
exports.runIndexing = (app) => { exports.runIndexing = (app) => {
if(process.env.NODE_ENV !== 'production'){
return Promise.resolve();
}
console.info(colors.yellow('Setting up indexes..')); console.info(colors.yellow('Setting up indexes..'));
return Promise.all([ return Promise.all([