1 |
|
2 | var ConnectionConfig = require('./ConnectionConfig');
|
3 |
|
4 | module.exports = PoolConfig;
|
5 | function PoolConfig(options) {
|
6 | if (typeof options === 'string') {
|
7 | options = ConnectionConfig.parseUrl(options);
|
8 | }
|
9 |
|
10 | this.acquireTimeout = (options.acquireTimeout === undefined)
|
11 | ? 10 * 1000
|
12 | : Number(options.acquireTimeout);
|
13 | this.connectionConfig = new ConnectionConfig(options);
|
14 | this.waitForConnections = (options.waitForConnections === undefined)
|
15 | ? true
|
16 | : Boolean(options.waitForConnections);
|
17 | this.connectionLimit = (options.connectionLimit === undefined)
|
18 | ? 10
|
19 | : Number(options.connectionLimit);
|
20 | this.queueLimit = (options.queueLimit === undefined)
|
21 | ? 0
|
22 | : Number(options.queueLimit);
|
23 | }
|
24 |
|
25 | PoolConfig.prototype.newConnectionConfig = function newConnectionConfig() {
|
26 | var connectionConfig = new ConnectionConfig(this.connectionConfig);
|
27 |
|
28 | connectionConfig.clientFlags = this.connectionConfig.clientFlags;
|
29 | connectionConfig.maxPacketSize = this.connectionConfig.maxPacketSize;
|
30 |
|
31 | return connectionConfig;
|
32 | };
|