mysql2 3.3.1 → 3.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -134,7 +134,9 @@ const pool = mysql.createPool({
134
134
  connectionLimit: 10,
135
135
  maxIdle: 10, // max idle connections, the default value is the same as `connectionLimit`
136
136
  idleTimeout: 60000, // idle connections timeout, in milliseconds, the default value 60000
137
- queueLimit: 0
137
+ queueLimit: 0,
138
+ enableKeepAlive: true,
139
+ keepAliveInitialDelay: 0
138
140
  });
139
141
  ```
140
142
  The pool does not create all connections upfront but creates them on demand until the connection limit is reached.
package/lib/connection.js CHANGED
@@ -52,9 +52,10 @@ class Connection extends EventEmitter {
52
52
  opts.config.host
53
53
  );
54
54
 
55
- // Enable keep-alive on the socket. It's disabled by default, but the
56
- // user can enable it and supply an initial delay.
57
- this.stream.setKeepAlive(true, this.config.keepAliveInitialDelay);
55
+ // Optionally enable keep-alive on the socket.
56
+ if (this.config.enableKeepAlive) {
57
+ this.stream.setKeepAlive(true, this.config.keepAliveInitialDelay);
58
+ }
58
59
 
59
60
  // Enable TCP_NODELAY flag. This is needed so that the network packets
60
61
  // are sent immediately to the server
@@ -115,7 +115,7 @@ class ConnectionConfig {
115
115
  this.debug = options.debug;
116
116
  this.trace = options.trace !== false;
117
117
  this.stringifyObjects = options.stringifyObjects || false;
118
- this.enableKeepAlive = !!options.enableKeepAlive;
118
+ this.enableKeepAlive = options.enableKeepAlive !== false;
119
119
  this.keepAliveInitialDelay = options.keepAliveInitialDelay || 0;
120
120
  if (
121
121
  options.timezone &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mysql2",
3
- "version": "3.3.1",
3
+ "version": "3.3.2",
4
4
  "description": "fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -44,13 +44,12 @@ declare namespace Pool {
44
44
  queueLimit?: number;
45
45
 
46
46
  /**
47
- * Enable keep-alive on the socket. It's disabled by default, but the
48
- * user can enable it and supply an initial delay.
47
+ * Enable keep-alive on the socket. (Default: true)
49
48
  */
50
49
  enableKeepAlive?: boolean;
51
50
 
52
51
  /**
53
- * If keep-alive is enabled users can supply an initial delay.
52
+ * If keep-alive is enabled users can supply an initial delay. (Default: 0)
54
53
  */
55
54
  keepAliveInitialDelay?: number;
56
55
  }