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

Commit 40cf6bf5 by Dejan Ranisavljevic

Destroy all connections on process exit once pools are drained.

1 parent 40cd8d97
Showing with 9 additions and 4 deletions
......@@ -44,8 +44,12 @@ ConnectionManager = function(dialect, sequelize) {
};
ConnectionManager.prototype.onProcessExit = function() {
var self = this
if (this.pool) {
this.pool.drain();
this.pool.drain(function() {
self.pool.destroyAllNow();
});
}
};
......@@ -116,9 +120,10 @@ ConnectionManager.prototype.initPools = function () {
destroy: function(connection) {
return self.pool[connection.queryType].destroy(connection);
},
drain: function() {
self.pool.read.drain();
self.pool.write.drain();
drain: function(cb) {
self.pool.write.drain(function() {
self.pool.read.drain(cb);
});
},
read: Pooling.Pool({
name: 'sequelize-connection-read',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!