不要怂,就是干,撸起袖子干!

Commit 940f8fb6 by Simon Paris Committed by Jan Aagaard Meier

Fixed a bug causing all connection attempts to fail if the first connection attempt failed

1 parent ae60c4ac
Showing with 5 additions and 1 deletions
...@@ -18,6 +18,7 @@ ConnectionManager = function(dialect, sequelize) { ...@@ -18,6 +18,7 @@ ConnectionManager = function(dialect, sequelize) {
this.sequelize = sequelize; this.sequelize = sequelize;
this.config = config; this.config = config;
this.dialect = dialect; this.dialect = dialect;
this.versionPromise = null;
if (config.pool) { if (config.pool) {
config.pool = _.clone(config.pool); // Make sure we don't modify the existing config object (user might re-use it) config.pool = _.clone(config.pool); // Make sure we don't modify the existing config object (user might re-use it)
...@@ -199,10 +200,13 @@ ConnectionManager.prototype.getConnection = function(options) { ...@@ -199,10 +200,13 @@ ConnectionManager.prototype.getConnection = function(options) {
return self.sequelize.databaseVersion(_options).then(function (version) { return self.sequelize.databaseVersion(_options).then(function (version) {
self.sequelize.options.databaseVersion = semver.valid(version) ? version : self.defaultVersion; self.sequelize.options.databaseVersion = semver.valid(version) ? version : self.defaultVersion;
self.versionPromise = undefined; self.versionPromise = null;
self.$disconnect(connection); self.$disconnect(connection);
}); });
}).catch(function (err) {
self.versionPromise = null;
throw err;
}); });
} }
} else { } else {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!