33 lines
1.0 KiB
JavaScript
33 lines
1.0 KiB
JavaScript
|
|
var ConnectionConfig = require('./ConnectionConfig');
|
|
|
|
module.exports = PoolConfig;
|
|
function PoolConfig(options) {
|
|
if (typeof options === 'string') {
|
|
options = ConnectionConfig.parseUrl(options);
|
|
}
|
|
|
|
this.acquireTimeout = (options.acquireTimeout === undefined)
|
|
? 10 * 1000
|
|
: Number(options.acquireTimeout);
|
|
this.connectionConfig = new ConnectionConfig(options);
|
|
this.waitForConnections = (options.waitForConnections === undefined)
|
|
? true
|
|
: Boolean(options.waitForConnections);
|
|
this.connectionLimit = (options.connectionLimit === undefined)
|
|
? 10
|
|
: Number(options.connectionLimit);
|
|
this.queueLimit = (options.queueLimit === undefined)
|
|
? 0
|
|
: Number(options.queueLimit);
|
|
}
|
|
|
|
PoolConfig.prototype.newConnectionConfig = function newConnectionConfig() {
|
|
var connectionConfig = new ConnectionConfig(this.connectionConfig);
|
|
|
|
connectionConfig.clientFlags = this.connectionConfig.clientFlags;
|
|
connectionConfig.maxPacketSize = this.connectionConfig.maxPacketSize;
|
|
|
|
return connectionConfig;
|
|
};
|