Skip to content

Commit

Permalink
fix - Add connect MongoDB retry options(cnodejs#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
Debiancc committed Oct 1, 2018
1 parent b088d30 commit 3542994
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bin/generate_access_token.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions config/config.default.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
};

Expand Down

0 comments on commit 3542994

Please sign in to comment.