mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
add ability to specify pool size for mongodb (#10481)
This commit is contained in:
@@ -4,6 +4,7 @@ import mongoose from 'mongoose';
|
|||||||
|
|
||||||
const IS_PROD = nconf.get('IS_PROD');
|
const IS_PROD = nconf.get('IS_PROD');
|
||||||
const MAINTENANCE_MODE = nconf.get('MAINTENANCE_MODE');
|
const MAINTENANCE_MODE = nconf.get('MAINTENANCE_MODE');
|
||||||
|
const POOL_SIZE = nconf.get('MONGODB_POOL_SIZE');
|
||||||
|
|
||||||
// Do not connect to MongoDB when in maintenance mode
|
// Do not connect to MongoDB when in maintenance mode
|
||||||
if (MAINTENANCE_MODE !== 'true') {
|
if (MAINTENANCE_MODE !== 'true') {
|
||||||
@@ -12,6 +13,8 @@ if (MAINTENANCE_MODE !== 'true') {
|
|||||||
connectTimeoutMS: 30000,
|
connectTimeoutMS: 30000,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (POOL_SIZE) mongooseOptions.poolSize = Number(POOL_SIZE);
|
||||||
|
|
||||||
const NODE_DB_URI = nconf.get('IS_TEST') ? nconf.get('TEST_DB_URI') : nconf.get('NODE_DB_URI');
|
const NODE_DB_URI = nconf.get('IS_TEST') ? nconf.get('TEST_DB_URI') : nconf.get('NODE_DB_URI');
|
||||||
|
|
||||||
mongoose.connect(NODE_DB_URI, mongooseOptions, (err) => {
|
mongoose.connect(NODE_DB_URI, mongooseOptions, (err) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user