Fix #822, pool: {max: 0} should not init pooling

This commit is contained in:
Tim Griesser 2015-05-13 15:20:01 -04:00
parent d0faa82a0f
commit 054be46068
4 changed files with 20 additions and 2 deletions

View File

@ -37,7 +37,9 @@ function Client(config) {
this.connectionSettings = cloneDeep(config.connection || {});
if (this.driverName && config.connection) {
this.initializeDriver();
this.initializePool(config);
if (config.pool && config.pool.max !== 0) {
this.initializePool(config);
}
}
}
inherits(Client, EventEmitter);

View File

@ -36,7 +36,9 @@ function Client(config) {
this.connectionSettings = cloneDeep(config.connection || {})
if (this.driverName && config.connection) {
this.initializeDriver()
this.initializePool(config)
if (config.pool && config.pool.max !== 0) {
this.initializePool(config)
}
}
}
inherits(Client, EventEmitter)

View File

@ -10,6 +10,7 @@ Object.keys(knexfile).forEach(function(key) {
require('./raw')
require('./query-builder')
require('./seed')
require('./pool')
require('./knex')
var knex = makeKnex(knexfile[key])

13
test/tape/pool.js Normal file
View File

@ -0,0 +1,13 @@
'use strict';
var test = require('tape')
var Client = require('../../lib/client');
test('#822, pool config, max: 0 should skip pool construction', function(t) {
t.plan(1)
var client = new Client({pool: {max: 0}})
t.equal(client.pool, undefined)
})