diff --git a/package.json b/package.json index c48116f902c..41fd257be06 100644 --- a/package.json +++ b/package.json @@ -124,7 +124,7 @@ "moment": "^2.10.6", "mongodb": "^2.2.8", "mongodb-collection-model": "^0.3.0", - "mongodb-connection-model": "^6.2.0", + "mongodb-connection-model": "^6.3.0", "mongodb-data-service": "^2.0.0", "mongodb-database-model": "^0.1.2", "mongodb-explain-plan-model": "^0.2.1", diff --git a/src/app/index.js b/src/app/index.js index cf4b2e2a992..f24b297f5e6 100644 --- a/src/app/index.js +++ b/src/app/index.js @@ -335,6 +335,10 @@ app.extend({ return this.preferences.isFeatureEnabled(feature); }, setConnectionId: function(connectionId, done) { + if (state.connection && state.connection.getId() === connectionId) { + debug('Already connected to connectionId', connectionId); + return done(); + } var StatusAction = app.appRegistry.getAction('Status.Actions'); StatusAction.configure({ visible: true, diff --git a/src/app/models/connection.js b/src/app/models/connection.js index 92bb82b7480..6bd9eb3430f 100644 --- a/src/app/models/connection.js +++ b/src/app/models/connection.js @@ -72,6 +72,7 @@ module.exports = Connection.extend(storageMixin, { } }, test: function(done) { + var dataService = new DataService(this); var onTested = function(err) { if (err) { metrics.error(err); @@ -79,9 +80,10 @@ module.exports = Connection.extend(storageMixin, { } debug('test worked!'); + dataService.disconnect(); done(null, this); }.bind(this); - var dataService = new DataService(this); + debug('Testing connection to `%j`...', this.serialize()); dataService.connect(onTested); return this;