Skip to content

Commit

Permalink
Add connect MongoDB retry options(#133) (#146)
Browse files Browse the repository at this point in the history
* fix - Add connect MongoDB retry options(#133)

* fix - Update mongodb reconnect tries(#133)
  • Loading branch information
Debiancc authored and JacksonTian committed Oct 17, 2018
1 parent b088d30 commit 807a0b8
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: 10,
reconnectInterval: 500,
},
};

Expand Down

0 comments on commit 807a0b8

Please sign in to comment.