Skip to content

Commit

Permalink
[misc] pool handling error after connection fail to create handling
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Jan 31, 2019
1 parent e6d2372 commit b492af3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions test/integration/test-pool-callback.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions test/integration/test-pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit b492af3

Please sign in to comment.