diff --git a/bin/generate_access_token.js b/bin/generate_access_token.js index 21443ed3..b6e6adda 100644 --- a/bin/generate_access_token.js +++ b/bin/generate_access_token.js @@ -10,7 +10,7 @@ const UserModel = require('../app/model/user')({ mongoose, }); -mongoose.connect(config.mongoose.url, function(err) { +mongoose.connect(config.mongoose.url, config.mongoose.options, function(err) { if (err) { console.error('connect to %s error: ', config.mongoose, err.message); process.exit(1); diff --git a/config/config.default.js b/config/config.default.js index eb9c2f41..96a25a04 100644 --- a/config/config.default.js +++ b/config/config.default.js @@ -118,6 +118,8 @@ module.exports = appInfo => { url: process.env.EGG_MONGODB_URL || 'mongodb://127.0.0.1:27017/egg_cnode', options: { server: { poolSize: 20 }, + reconnectTries: Number.MAX_VALUE, + reconnectInterval: 500, }, };