Only running indexing on production startup
parent
7037e18017
commit
a8d5a60ee0
2
app.js
2
app.js
|
@ -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')))
|
||||||
|
|
|
@ -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([
|
||||||
|
|
Loading…
Reference in New Issue