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

Commit fea0ca73 by Sushant Committed by GitHub

fix(memory-utilization): don't keep bounded reference of connection manager (#8760)

1 parent b4fd4642
Showing with 3 additions and 6 deletions
...@@ -43,9 +43,9 @@ class ConnectionManager { ...@@ -43,9 +43,9 @@ class ConnectionManager {
Promise Promise
}); });
// Save a reference to the bound version so we can remove it with removeListener process.on('beforeExit', () => {
this._onProcessExit = this._onProcessExit.bind(this); this._onProcessExit.call(this);
process.on('exit', this._onProcessExit); });
this.initPools(); this.initPools();
} }
...@@ -85,9 +85,6 @@ class ConnectionManager { ...@@ -85,9 +85,6 @@ class ConnectionManager {
* @return {Promise} * @return {Promise}
*/ */
close() { close() {
// Remove the listener, so all references to this instance can be garbage collected.
process.removeListener('exit', this._onProcessExit);
// Mark close of pool // Mark close of pool
this.getConnection = function getConnection() { this.getConnection = function getConnection() {
return Promise.reject(new Error('ConnectionManager.getConnection was called after the connection manager was closed!')); return Promise.reject(new Error('ConnectionManager.getConnection was called after the connection manager was closed!'));
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!