mirror of
https://github.com/knex/knex.git
synced 2025-12-26 06:28:37 +00:00
Fix #822, pool: {max: 0} should not init pooling
This commit is contained in:
parent
d0faa82a0f
commit
054be46068
@ -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);
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
13
test/tape/pool.js
Normal 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)
|
||||
|
||||
})
|
||||
Loading…
x
Reference in New Issue
Block a user