Skip to content

Commit 807a0b8

Browse files
DebianccJacksonTian
authored andcommitted
Add connect MongoDB retry options(#133) (#146)
* fix - Add connect MongoDB retry options(#133) * fix - Update mongodb reconnect tries(#133)
1 parent b088d30 commit 807a0b8

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

bin/generate_access_token.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const UserModel = require('../app/model/user')({
1010
mongoose,
1111
});
1212

13-
mongoose.connect(config.mongoose.url, function(err) {
13+
mongoose.connect(config.mongoose.url, config.mongoose.options, function(err) {
1414
if (err) {
1515
console.error('connect to %s error: ', config.mongoose, err.message);
1616
process.exit(1);

config/config.default.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ module.exports = appInfo => {
118118
url: process.env.EGG_MONGODB_URL || 'mongodb://127.0.0.1:27017/egg_cnode',
119119
options: {
120120
server: { poolSize: 20 },
121+
reconnectTries: 10,
122+
reconnectInterval: 500,
121123
},
122124
};
123125

0 commit comments

Comments
 (0)