From 554eb628eb61dd44324c13e8213cded456a0a6aa Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Sat, 8 Oct 2016 06:47:35 +1100 Subject: [PATCH] Reconnect to mongo indefinitely. (#7880) * Reconnect to mongo indefinitely. A fix for https://github.com/meteor/meteor/issues/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 --- packages/mongo/mongo_driver.js | 18 +++++++++--------- packages/mongo/package.js | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/mongo/mongo_driver.js b/packages/mongo/mongo_driver.js index 567c349e4cb..5d5ecbdcb8d 100644 --- a/packages/mongo/mongo_driver.js +++ b/packages/mongo/mongo_driver.js @@ -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. diff --git a/packages/mongo/package.js b/packages/mongo/package.js index 5af9494d1f9..c22cca55f22 100644 --- a/packages/mongo/package.js +++ b/packages/mongo/package.js @@ -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({