From f5ebd3e8da81d9dcf453fe4a1cf890072e2d80e9 Mon Sep 17 00:00:00 2001 From: Anton Date: Sun, 8 Oct 2017 21:48:20 +0400 Subject: [PATCH 1/6] Update Client.js Fixed error "RangeError: Maximum call stack size exceeded" when many concurent queries in same time. --- lib/Client.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/Client.js b/lib/Client.js index 7b5979b..484fc59 100644 --- a/lib/Client.js +++ b/lib/Client.js @@ -607,10 +607,12 @@ Client.prototype._processQueue = function(ignoreConnected) { this._tmrInactive = undefined; req = this._req = queue[0]; - this._handle.query(req.str, - req.needColumns, - req.needMetadata, - req.cb !== undefined); + process.nextTick(() => { + this._handle.query(req.str, + req.needColumns, + req.needMetadata, + req.cb !== undefined); + }); } else if (connected) { if (this.closing && !this._handleClosing) { this._handleClosing = true; From 4fc757345fdbf4e0cf246cca4b59086cafbda5d6 Mon Sep 17 00:00:00 2001 From: Anton Date: Sun, 8 Oct 2017 21:54:27 +0400 Subject: [PATCH 2/6] Update Client.js Formatting --- lib/Client.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Client.js b/lib/Client.js index 484fc59..c7e30f8 100644 --- a/lib/Client.js +++ b/lib/Client.js @@ -609,9 +609,9 @@ Client.prototype._processQueue = function(ignoreConnected) { req = this._req = queue[0]; process.nextTick(() => { this._handle.query(req.str, - req.needColumns, - req.needMetadata, - req.cb !== undefined); + req.needColumns, + req.needMetadata, + req.cb !== undefined); }); } else if (connected) { if (this.closing && !this._handleClosing) { From 181bab5595cca66247d11e26b8a2931bae06f002 Mon Sep 17 00:00:00 2001 From: Anton Date: Tue, 10 Oct 2017 09:57:55 +0400 Subject: [PATCH 3/6] Update Client.js Change () => {} to function() {}, to keep old verisons of node.js support --- lib/Client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Client.js b/lib/Client.js index c7e30f8..fbb03ed 100644 --- a/lib/Client.js +++ b/lib/Client.js @@ -607,7 +607,7 @@ Client.prototype._processQueue = function(ignoreConnected) { this._tmrInactive = undefined; req = this._req = queue[0]; - process.nextTick(() => { + process.nextTick(function() { this._handle.query(req.str, req.needColumns, req.needMetadata, From f39fd3041362bac0978fb2395e4d03a78128b8c7 Mon Sep 17 00:00:00 2001 From: Anton Date: Tue, 10 Oct 2017 10:44:37 +0400 Subject: [PATCH 4/6] Update Client.js --- lib/Client.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Client.js b/lib/Client.js index fbb03ed..84ad2bb 100644 --- a/lib/Client.js +++ b/lib/Client.js @@ -607,8 +607,9 @@ Client.prototype._processQueue = function(ignoreConnected) { this._tmrInactive = undefined; req = this._req = queue[0]; + var self = this; process.nextTick(function() { - this._handle.query(req.str, + self._handle.query(req.str, req.needColumns, req.needMetadata, req.cb !== undefined); From 8228b90104bafe5e5f4ad4d2661c464d032908f7 Mon Sep 17 00:00:00 2001 From: Anton Date: Tue, 10 Oct 2017 20:35:50 +0400 Subject: [PATCH 5/6] Now we can use .escape() before the connection is established Now we can use .escape() before the connection is established --- lib/Client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Client.js b/lib/Client.js index 84ad2bb..62e4c17 100644 --- a/lib/Client.js +++ b/lib/Client.js @@ -285,7 +285,7 @@ Client.prototype.lastInsertId = function() { Client.prototype.escape = function(str) { this._initHandle(); - return this._handle.escape(str); + return addon.escape(str); }; Client.prototype.serverVersion = function() { From a379a13d11326d230825666ed5b048ac9665dad0 Mon Sep 17 00:00:00 2001 From: Anton Date: Wed, 18 Oct 2017 14:39:14 +0400 Subject: [PATCH 6/6] Update Client.js --- lib/Client.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/Client.js b/lib/Client.js index 62e4c17..c36ce76 100644 --- a/lib/Client.js +++ b/lib/Client.js @@ -284,7 +284,6 @@ Client.prototype.lastInsertId = function() { }; Client.prototype.escape = function(str) { - this._initHandle(); return addon.escape(str); };