From 406357b9c621121bbfd168544103d3b34f19c323 Mon Sep 17 00:00:00 2001 From: brianc Date: Tue, 21 Jun 2016 22:03:25 -0500 Subject: [PATCH] Better indication that pg.pools is a private api --- lib/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/index.js b/lib/index.js index 3e5121e..0aa23fd 100644 --- a/lib/index.js +++ b/lib/index.js @@ -12,7 +12,7 @@ var PG = function(clientConstructor) { this.Client = clientConstructor; this.Query = this.Client.Query; this.Pool = Pool; - this.pools = []; + this._pools = []; this.Connection = Connection; this.types = require('pg-types'); }; @@ -21,14 +21,14 @@ util.inherits(PG, EventEmitter); PG.prototype.end = function() { var self = this; - var keys = Object.keys(this.pools); + var keys = Object.keys(this._pools); var count = keys.length; if(count === 0) { self.emit('end'); } else { keys.forEach(function(key) { - var pool = self.pools[key]; - delete self.pools[key]; + var pool = self._pools[key]; + delete self._pools[key]; pool.pool.drain(function() { pool.pool.destroyAllNow(function() { count--; @@ -58,8 +58,8 @@ PG.prototype.connect = function(config, callback) { config.idleTimeoutMillis = config.idleTimeoutMillis || config.poolIdleTimeout || defaults.poolIdleTimeout; config.log = config.log || config.poolLog || defaults.poolLog; - this.pools[poolName] = this.pools[poolName] || new Pool(config, this.Client); - var pool = this.pools[poolName]; + this._pools[poolName] = this._pools[poolName] || new Pool(config, this.Client); + var pool = this._pools[poolName]; pool.connect(callback); if(!pool.listeners('error').length) { //propagate errors up to pg object