mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Set mongoOptions.server.reconnectTries = Infinity.
Setting mongoOptions.server.auto_reconnect was removed by #7880 via commit
0ffb9ac824, though it seems the Server
options still respect autoReconnect, even in version 2.2 of the driver:
http://mongodb.github.io/node-mongodb-native/2.2/api/Server.html
That said, having inspected the code of the `mongodb` package, I do not
believe this change is really critical, since the default value for
autoReconnect appears to be true.
More importantly, I can't find any support in the code of the `mongodb`
npm package or its dependencies for the claim that setting
mongoOptions.server.reconnectTries to 0 is the same as making it infinite,
so this commit sets it to Infinity.
This commit is contained in:
@@ -131,14 +131,17 @@ MongoConnection = function (url, options) {
|
||||
self._onFailoverHook = new Hook;
|
||||
|
||||
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: {}
|
||||
db: { safe: true },
|
||||
// http://mongodb.github.io/node-mongodb-native/2.2/api/Server.html
|
||||
server: {
|
||||
// Reconnect on error.
|
||||
autoReconnect: true,
|
||||
// Try to reconnect forever, instead of stopping after 30 tries (the
|
||||
// default), with each attempt separated by 1000ms.
|
||||
reconnectTries: Infinity
|
||||
},
|
||||
Mongo._connectionOptions);
|
||||
replSet: {}
|
||||
}, Mongo._connectionOptions);
|
||||
|
||||
// Disable the native parser by default, unless specifically enabled
|
||||
// in the mongo URL.
|
||||
|
||||
Reference in New Issue
Block a user