diff --git a/lib/pool.js b/lib/pool.js index 46c6c4e6..2dceabb0 100644 --- a/lib/pool.js +++ b/lib/pool.js @@ -265,7 +265,7 @@ function Pool(options, useCallback) { firstTaskTimeout = null; if (task === taskQueue.peekFront()) { taskQueue.shift(); - task.reject( + process.nextTick(task.reject, Errors.createError( "retrieve connection from pool timeout", false, @@ -315,7 +315,7 @@ function Pool(options, useCallback) { } connectionInCreation = false; - if (taskQueue.size() > 0 || !err.no || err.no !== 1045) { + if (taskQueue.size() > 0 || !err.errno || err.errno !== 1045) { // in case of wrong authentication, not relaunching automatic connection creation. checkPoolSize(pool); } diff --git a/test/integration/test-pool-callback.js b/test/integration/test-pool-callback.js index ffb5f5ea..7c458c23 100644 --- a/test/integration/test-pool-callback.js +++ b/test/integration/test-pool-callback.js @@ -6,7 +6,7 @@ const Conf = require("../conf"); describe("Pool callback", () => { it("pool with wrong authentication", function(done) { - this.timeout(5000); + this.timeout(10000); const pool = base.createPoolCallback({ connectionLimit: 3, user: "wrongAuthentication" }); pool.query("SELECT 1", err => { if (!err) { @@ -31,7 +31,7 @@ describe("Pool callback", () => { }); it("pool with wrong authentication connection", function(done) { - this.timeout(5000); + this.timeout(10000); const pool = base.createPoolCallback({ connectionLimit: 3, user: "wrongAuthentication" }); pool.getConnection(err => { if (!err) { diff --git a/test/integration/test-pool.js b/test/integration/test-pool.js index 29b7c457..1be69631 100644 --- a/test/integration/test-pool.js +++ b/test/integration/test-pool.js @@ -18,7 +18,7 @@ describe("Pool", () => { }); it("pool with wrong authentication", function(done) { - this.timeout(5000); + this.timeout(10000); const pool = base.createPool({ connectionLimit: 3, user: "wrongAuthentication" }); pool .query("SELECT 1") @@ -52,7 +52,7 @@ describe("Pool", () => { }); it("pool with wrong authentication connection", function(done) { - this.timeout(5000); + this.timeout(10000); const pool = base.createPool({ connectionLimit: 3, user: "wrongAuthentication" }); pool .getConnection()