Skip to content

Commit

Permalink
Reconnect to mongo indefinitely. (#7880)
Browse files Browse the repository at this point in the history
* Reconnect to mongo indefinitely.

A fix for #7822

It seems the driver now always autoReconnects, but only for 30s.

To get the old (sensible) behavior of endlessly reconnecting, we set `reconnectTries` to 0.

* Releasing an rc of mongo package
  • Loading branch information
Tom Coleman authored and benjamn committed Oct 21, 2016
1 parent 738f756 commit 554eb62
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions packages/mongo/mongo_driver.js
Expand Up @@ -130,15 +130,15 @@ MongoConnection = function (url, options) {
self._observeMultiplexers = {};
self._onFailoverHook = new Hook;

var mongoOptions = _.extend({db: {safe: true}, server: {}, replSet: {}},
Mongo._connectionOptions);

// Set autoReconnect to true, unless passed on the URL. Why someone
// would want to set autoReconnect to false, I'm not really sure, but
// keeping this for backwards compatibility for now.
if (!(/[\?&]auto_?[rR]econnect=/.test(url))) {
mongoOptions.server.auto_reconnect = true;
}
var mongoOptions = _.extend({
db: { safe: true },
// Set reconnectTries to 0 which means keep trying to reconnect forever,
// rather than the default of losing the connection permanently after 30
// retries (separated by 1000ms).
server: { reconnectTries: 0 },
replSet: {}
},
Mongo._connectionOptions);

// Disable the native parser by default, unless specifically enabled
// in the mongo URL.
Expand Down
2 changes: 1 addition & 1 deletion packages/mongo/package.js
Expand Up @@ -9,7 +9,7 @@

Package.describe({
summary: "Adaptor for using MongoDB and Minimongo over DDP",
version: '1.1.12_1'
version: '1.1.12-2-rc.0'
});

Npm.depends({
Expand Down

0 comments on commit 554eb62

Please sign in to comment.